Skip to content

Commit a06dc69

Browse files
authored
fix(core): canonicalize resource dir to fix scope check, closes #5196 (#5218)
1 parent ca3cd8b commit a06dc69

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

.changes/fix-resource-scope.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"tauri": patch
3+
---
4+
5+
Fixes resource reading being always rejected by the scope.

.changes/resource-dir-canonicalize.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"tauri-utils": patch
3+
---
4+
5+
Canonicalize the return value of `platform::resource_dir`.

core/tauri-utils/src/platform.rs

+8-2
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,10 @@ pub fn resource_dir(package_info: &PackageInfo, env: &Env) -> crate::Result<Path
172172
{
173173
res = if curr_dir.ends_with("/data/usr/bin") {
174174
// running from the deb bundle dir
175-
Ok(exe_dir.join(format!("../lib/{}", package_info.package_name())))
175+
exe_dir
176+
.join(format!("../lib/{}", package_info.package_name()))
177+
.canonicalize()
178+
.map_err(Into::into)
176179
} else if let Some(appdir) = &env.appdir {
177180
let appdir: &std::path::Path = appdir.as_ref();
178181
Ok(PathBuf::from(format!(
@@ -191,7 +194,10 @@ pub fn resource_dir(package_info: &PackageInfo, env: &Env) -> crate::Result<Path
191194

192195
#[cfg(target_os = "macos")]
193196
{
194-
res = Ok(exe_dir.join("../Resources"));
197+
res = exe_dir
198+
.join("../Resources")
199+
.canonicalize()
200+
.map_err(Into::into);
195201
}
196202

197203
res

0 commit comments

Comments
 (0)