Skip to content

Commit

Permalink
fix: allow return value of fs::canonicalize on fs scope, closes #4130 (
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasfernog authored May 21, 2022
1 parent 72700ec commit 78f2565
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changes/fix-fs-scope-windows.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"tauri": patch
---

Allow the canonical, absolute form of a path for the filesystem scope on Windows if `std::fs::canonicalize` returns a path, fallback to `\\?\$PATH`.
6 changes: 5 additions & 1 deletion core/tauri/src/scope/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,11 @@ fn push_pattern<P: AsRef<Path>>(list: &mut HashSet<Pattern>, pattern: P) -> crat
list.insert(Pattern::new(&path.to_string_lossy())?);
#[cfg(windows)]
{
list.insert(Pattern::new(&format!("\\\\?\\{}", path.display()))?);
if let Ok(p) = std::fs::canonicalize(&path) {
list.insert(Pattern::new(&p.to_string_lossy())?);
} else {
list.insert(Pattern::new(&format!("\\\\?\\{}", path.display()))?);
}
}
Ok(())
}
Expand Down

0 comments on commit 78f2565

Please sign in to comment.