Skip to content

Commit

Permalink
fix: canonicalize out_dir
Browse files Browse the repository at this point in the history
  • Loading branch information
jason-crabnebula committed Aug 16, 2024
1 parent 8d120c7 commit af6cd38
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
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
4 changes: 2 additions & 2 deletions crates/packager/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(dunce::canonicalize(dest_path)?));
return Ok(Some(dest_path));
}
}
}
Expand Down Expand Up @@ -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(dunce::canonicalize(dest_path)?))
Ok(Some(dest_path))
} else {
Err(crate::Error::InvalidIconList)
}
Expand Down

0 comments on commit af6cd38

Please sign in to comment.