Skip to content

Commit

Permalink
fix: ensure extracts files correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
swarnimarun committed Dec 21, 2023
1 parent e9941ed commit 60c5e52
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/source/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,9 +288,17 @@ fn extract(
}
let path = target_directory.join(path);
if entry.header().entry_type().is_dir() {
// only errors if fails to create dir
// and if file doesn't already exists
std::fs::create_dir_all(&path)?;
continue;
}
// create parent dir if doesn't already exists before unpacking
if let Some(parent) = path.parent() {
if !parent.exists() {
std::fs::create_dir_all(parent)?;
}
}
// should setup permissions and xattrs
entry.unpack(path)?;
}
Expand Down

0 comments on commit 60c5e52

Please sign in to comment.