#How to open a folder?

2 messages · Page 1 of 1 (latest)

cosmic stump
#

i made this:

import { Command } from '@tauri-apps/api/shell'
async openGameDirectory() {
        const platform = await getPlatform();
        const gameDirectory = "Desktop";

        let bin;
        let args = [];

        switch(platform) {
            case "win32":
                bin = "start";
                args.push("", gameDirectory);
                break;
            case "darwin":
                bin = "open";
                args.push("-R", gameDirectory);
                break;
            default:
                throw new Error(`Unsupported platform: ${platform}`);
        };
    
        try {
            const command = new Command(bin, args);
            const result = await command.execute();
            console.log(result);  // Log the result if needed
        } catch (error) {
            console.error('Error executing command:', error);
        }
    };

but i'm getting this error: Error executing command:"program not allowed on the configured shell scope: open"
even though the perms allow all shell scopes:

#
"scope": [{
          "name": "open",
          "cmd": "open",
          "args": ["*"]
        }]
``` 
i added this and this was logged: `{code: 1, signal: null, stdout: "", stderr: "The file /..../LauncherNew/src-tauri/* does not exist.↵"}`
like? why check under src-tauri when im trying to open desktop ?