Hi Willa - welcome to the Creative Cloud developer ecosystem! I’m assuming you’re trying to circumvent the file picker part of the workflow, and open a file with a known path without any user interaction. Unfortunately, UXP does not allow third parties to open files by just providing a path and requires user input for any file when you used getFileForOpening()
.
Instead, if your file is in your data folder, you should be able to get a token for it using
const fs = require('uxp').storage.localFileSystem;
const df = await fs.getDataFolder();
const token = df.getEntry('filename.cube')
or plugin folder:
const fs = require('uxp').storage.localFileSystem;
const df = await fs.getPluginFolder();
const token = df.getEntry('filename.cube')
Here’s the corresponding documentation. As long as you’re within the data or plugin folder sandbox, you can access/open files in there without user interaction.
Hope this helps!