`Project.importFiles` returns false positive

Project.importFiles(['']) returns true, but false is expected because the given path does not exist. Running the method will briefly show the import dialog and focuses the project panel.

const app = require("premierepro");
const proj = await app.Project.getActiveProject();
const success = await proj.importFiles([""]);
console.log({ success }); // { success: true }
2 Likes

This matches the pattern reported for importAEComps in June: the promise resolving true looks like it means the request was handed off to the importer, not that the input was validated or that anything actually landed in the project.

Since the boolean won’t flag a bad path, doing the check yourself before the call is the practical guard — resolve each path through the UXP file-system API and skip the ones it can’t open. If you also need to know whether media really arrived, compare the project contents around the call (for example the children of getRootItem()) instead of trusting the return value.

With [‘’] specifically, the import dialog still coming up suggests the empty string is passed straight through rather than rejected up front.

Always returning true isn’t too helpful or practical, so we should get some sort of useful result here.

Ideally returning the files that were imported or an error if import failed.

There’s a lot of reasons an import can fail: Bad Path, Incorrect File Type, Corrupt File, etc. It’s not possible to check for all of these things on the 3rd party side.

Importing and then trying to find the imported file after the fact is what we did in ExtendScript but it wasn’t great, this really needs a more useful return value of some sort, a boolean at the very least.

1 Like