From 8d120c7585022e6ad7d7ca97b45d88dd582f934a Mon Sep 17 00:00:00 2001 From: Jason Date: Tue, 23 Jul 2024 22:09:36 +0800 Subject: [PATCH] fix(dmg): canonicalize path returns from `create_icns_file` --- .changes/fix-dmg-failed-with-out-dir.md | 5 +++++ crates/packager/src/util.rs | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 .changes/fix-dmg-failed-with-out-dir.md diff --git a/.changes/fix-dmg-failed-with-out-dir.md b/.changes/fix-dmg-failed-with-out-dir.md new file mode 100644 index 00000000..fe468983 --- /dev/null +++ b/.changes/fix-dmg-failed-with-out-dir.md @@ -0,0 +1,5 @@ +--- +"cargo-packager": patch +--- + +Fixed dmg failed to bundle the application when out-dir does not exist. diff --git a/crates/packager/src/util.rs b/crates/packager/src/util.rs index fa3f9bc8..6e130a0f 100644 --- a/crates/packager/src/util.rs +++ b/crates/packager/src/util.rs @@ -315,7 +315,7 @@ pub fn create_icns_file(out_dir: &Path, config: &crate::Config) -> crate::Result ); std::fs::copy(&icon_path, &dest_path)?; - return Ok(Some(dest_path)); + return Ok(Some(dunce::canonicalize(dest_path)?)); } } } @@ -379,7 +379,7 @@ pub fn create_icns_file(out_dir: &Path, config: &crate::Config) -> crate::Result dest_path.set_extension("icns"); let icns_file = std::io::BufWriter::new(File::create(&dest_path)?); family.write(icns_file)?; - Ok(Some(dest_path)) + Ok(Some(dunce::canonicalize(dest_path)?)) } else { Err(crate::Error::InvalidIconList) }