-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
[bug] Can not use system base directory variables in shell cmd #5480
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Since this is effectively what you're doing manually here, did you take a look at the sidecar feature? https://tauri.app/v1/guides/building/sidecar |
Thanks for response! sidebar feature is very useful! |
I'm similarly running into this issue though can't use the sidecar due to the interplay between multiple binary files which all need to be colocated with each other). Although it doesn't print the file path in the error message, I'm fairly certain you're almost right @FabianLars and the issue is that it's messing up the path in i.e. for this example it would be at |
Have just tried it with |
We can surely improve the shell configuration to allow resolving the command path with the predefined variables, but be careful to not confuse the arbitrary shell command execution with a sidecar. |
Is it guaranteed that a sidecar always gets packaged into the resources directory? My "main" sidecar binary has some dynamically linked libraries that it needs to be colocated with so need to have those end up in the same place. |
Not really @JMMarchant that's one of the limitations of a sidecar. We'll try to include this enhancement on v1.2. |
Describe the bug
I want to use shell command api to run a executable file, here is my code:
`
And here is my tauri.conf.json
"shell": { "all": true, "execute": true, "sidecar": true, "open": true, "scope": [{ "name": "download", "cmd": "$RESOURCE/sdk/you-get-darwin", "args": [{ "validator": "\\S+" }] }] }
This is result:

I check the resource directory(resourceDirPath = /Users/ianho/Documents/project/private/tauri-react-template/src-tauri/target/debug/

Index.tsx:61) and the executable file is exists.
Could you please tell my what's wrong with my code or the correct way to use tauri api, thank a lot!
Reproduction
No response
Expected behavior
No response
Platform and versions
Environment
› OS: Mac OS 12.3.1 X64
› Node.js: 16.13.0
› npm: 8.1.0
› pnpm: 7.13.5
› yarn: 1.22.10
› rustup: 1.25.1
› rustc: 1.64.0
› cargo: 1.64.0
› Rust toolchain: stable-x86_64-apple-darwin
Packages
› @tauri-apps/cli [NPM]: 1.1.1
› @tauri-apps/api [NPM]: 1.1.0
› tauri [RUST]: 1.0.5,
› tauri-build [RUST]: 1.0.4,
› tao [RUST]: 0.12.2,
› wry [RUST]: 0.19.0,
App
› build-type: bundle
› CSP: unset
› distDir: ../dist
› devPath: http://localhost:3000/
› framework: React
App directory structure
├─ dist
├─ node_modules
├─ src-tauri
├─ .git
└─ src
Stack trace
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: