I’m probably overlooking something simple here. I just want to create a folder if it does not exist.
In CEP, all I have to do is
let outputFolder = app.Folder(outputFolderStr);
if (!outputFolder.exists) outputFolder.create();
How can I do this in UXP?
According to the storage APIs, I cannot see an obvious way to create a folder reference to a specific folder. All it says is:
// These require no user interaction: const tempFolder = await fs.getTemporaryFolder(); const pluginFolder = await fs.getPluginFolder(); // read-only access to the plugin's install folder const pluginDataFolder = await fs.getDataFolder(); // folder to store settings // Display file/folder picker UI to access user files: const userFolder = await fs.getFolder(); // folder picker
To provide some context, we have an in-house batch image converter tool built in CEP which I want to convert to UXP. Two of the fields are input and output folders which are saved as preferences. And the artists prefer to copy and paste the directories from file explorer rather than use folder pickers.