Skip to content

Commit 99fe1c5

Browse files
authored
fix(core): resolve base dir in shell scope, closes #5480 (#5508)
1 parent 9b1a6a1 commit 99fe1c5

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

.changes/shell-resolve-base-dirs.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"tauri": "patch"
3+
---
4+
5+
Resolve base system directory in shell scope.

core/tauri/src/app.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1555,7 +1555,7 @@ impl<R: Runtime> Builder<R> {
15551555
#[cfg(http_request)]
15561556
http: crate::scope::HttpScope::for_http_api(&app.config().tauri.allowlist.http.scope),
15571557
#[cfg(shell_scope)]
1558-
shell: ShellScope::new(shell_scope),
1558+
shell: ShellScope::new(&app.manager.config(), app.package_info(), &env, shell_scope),
15591559
});
15601560
app.manage(env);
15611561

core/tauri/src/scope/shell.rs

+12-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ use crate::api::process::Command;
88
use crate::api::shell::Program;
99

1010
use regex::Regex;
11+
use tauri_utils::{config::Config, Env, PackageInfo};
1112

1213
use std::collections::HashMap;
1314

@@ -193,7 +194,17 @@ pub enum ScopeError {
193194

194195
impl Scope {
195196
/// Creates a new shell scope.
196-
pub(crate) fn new(scope: ScopeConfig) -> Self {
197+
pub(crate) fn new(
198+
config: &Config,
199+
package_info: &PackageInfo,
200+
env: &Env,
201+
mut scope: ScopeConfig,
202+
) -> Self {
203+
for cmd in scope.scopes.values_mut() {
204+
if let Ok(path) = crate::api::path::parse(config, package_info, env, &cmd.command) {
205+
cmd.command = path;
206+
}
207+
}
197208
Self(scope)
198209
}
199210

0 commit comments

Comments
 (0)