#Checking file exists results in "path not allowed on the configured scope"

5 messages · Page 1 of 1 (latest)

spring spear
#

Hey all, I have a simple flow where the user opens a directory (using dialog), and then I check if it has a .git directory, because we only want to allow opening repositories.

However, the exist check always fails with "path not allowed on the configured scope". Here's the code:

const homeDir = await path.homeDir(); // Has a trailing slash
const selectedDir = await dialog.open({
    defaultPath: homeDir,
    directory: true,
    recursive: true, // Adds scope permissions to nested files
});

if (!(await fs.exists(`${selectedDir}/.git`, { dir: fs.Dir.Home }))) {
    throw new Error('Directory must be a Git repository (.git not found)');
}

We only support repos within the user's home directory, so I also have this in scope: "scope": ["$HOME/**", "$HOME/*", "$HOME"]. But it still errors. Not sure what else to try.

#

The error does include the correct path: path not allowed on the configured scope: /Users/miles/Projects/.git

#

I've also tried relative paths, and different combinations of values to exists, but no luck.

true stratus
spring spear
#

I'm on mac, but maybe this will also apply since its unix based? Let me try.