Is it possible to open a file in Photoshop (UXP) using a local path that is not in the plugins directory?

I am trying to write a UXP Plugin that opens a file from a local path:

  const path = "/some/example/path/file";
  const pickedFile = await fs.getFileForOpening({ initialLocation: path });
  const openedFile = await app.open(pickedFile);

This seems to just open a file picker and not the file itself. I feel like I’m probably missing something super obvious.

thanks,
-Liz

Not possible. If you don’t want the user to “pick” the file, you either have to put it in the plugin’s folder or fetch it (Network I/O). To get a file from anywhere on the machine, you need to show the file-picker dialog outside the plugin folder (File access).

I assume you want to add some sort of permanent asset? If so, it’s better to put them in the plugin folder. Or fetch it once and put it in the Secure Storage, but you may lose it when the user uninstalls the plugin, so check for it and re-fetch it if it was not there on load.

1 Like

Got it. Thanks for the response!