Skip to content

Commit

Permalink
fix(dmg): canonicalize path returns from create_icns_file (#262)
Browse files Browse the repository at this point in the history
* fix(dmg): canonicalize path returns from `create_icns_file`

* fix: canonicalize `out_dir`
  • Loading branch information
jason-crabnebula committed Aug 21, 2024
1 parent 937de61 commit 21441f3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changes/fix-dmg-failed-with-out-dir.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"cargo-packager": patch
---

Fixed dmg failed to bundle the application when out-dir does not exist.
10 changes: 5 additions & 5 deletions crates/packager/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1792,13 +1792,13 @@ impl Config {
/// Returns the out dir. Defaults to the current directory.
pub fn out_dir(&self) -> PathBuf {
if self.out_dir.as_os_str().is_empty() {
std::env::current_dir().expect("failed to resolve cwd")
} else if self.out_dir.exists() {
dunce::canonicalize(&self.out_dir).unwrap_or_else(|_| self.out_dir.clone())
} else {
return std::env::current_dir().expect("failed to resolve cwd");
}

if !self.out_dir.exists() {
std::fs::create_dir_all(&self.out_dir).expect("failed to create output directory");
self.out_dir.clone()
}
dunce::canonicalize(&self.out_dir).unwrap_or_else(|_| self.out_dir.clone())
}

/// Returns the binaries dir. Defaults to [`Self::out_dir`] if [`Self::binaries_dir`] is not set.
Expand Down

0 comments on commit 21441f3

Please sign in to comment.