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.