Skip to content

Commit

Permalink
fix(core): canonicalize resource dir to fix scope check, closes #5196 (
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasfernog committed Sep 29, 2022
1 parent ca3cd8b commit a06dc69
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changes/fix-resource-scope.md
@@ -0,0 +1,5 @@
---
"tauri": patch
---

Fixes resource reading being always rejected by the scope.
5 changes: 5 additions & 0 deletions .changes/resource-dir-canonicalize.md
@@ -0,0 +1,5 @@
---
"tauri-utils": patch
---

Canonicalize the return value of `platform::resource_dir`.
10 changes: 8 additions & 2 deletions core/tauri-utils/src/platform.rs
Expand Up @@ -172,7 +172,10 @@ pub fn resource_dir(package_info: &PackageInfo, env: &Env) -> crate::Result<Path
{
res = if curr_dir.ends_with("/data/usr/bin") {
// running from the deb bundle dir
Ok(exe_dir.join(format!("../lib/{}", package_info.package_name())))
exe_dir
.join(format!("../lib/{}", package_info.package_name()))
.canonicalize()
.map_err(Into::into)
} else if let Some(appdir) = &env.appdir {
let appdir: &std::path::Path = appdir.as_ref();
Ok(PathBuf::from(format!(
Expand All @@ -191,7 +194,10 @@ pub fn resource_dir(package_info: &PackageInfo, env: &Env) -> crate::Result<Path

#[cfg(target_os = "macos")]
{
res = Ok(exe_dir.join("../Resources"));
res = exe_dir
.join("../Resources")
.canonicalize()
.map_err(Into::into);
}

res
Expand Down

0 comments on commit a06dc69

Please sign in to comment.