Skip to content

Commit

Permalink
tar_gz.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
kevgo committed Nov 14, 2023
1 parent 887accd commit dec6420
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/archives/tar_gz.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ impl Archive for TarGz {
fn extract(
&self,
data: Vec<u8>,
path_in_archive: &str,
path_on_disk: &Path,
filepath_in_archive: &str,
filepath_on_disk: &Path,
output: &dyn Output,
) -> Result<Executable> {
output.print("extracting tar.gz archive ... ");
Expand All @@ -31,15 +31,18 @@ impl Archive for TarGz {
let filepath = file.path().unwrap();
let filepath = filepath.to_string_lossy();
output.log(CATEGORY, &format!("- {filepath}"));
if filepath == path_in_archive {
if filepath == filepath_in_archive {
found_file = true;
file.unpack(path_on_disk).unwrap();
file.unpack(filepath_on_disk).unwrap();
}
}
assert!(found_file, "file {path_in_archive} not found in archive");
filesystem::make_file_executable(path_on_disk)?;
assert!(
found_file,
"file {filepath_in_archive} not found in archive"
);
filesystem::make_file_executable(filepath_on_disk)?;
output.println(&format!("{}", "ok".green()));
Ok(Executable(path_on_disk.to_path_buf()))
Ok(Executable(filepath_on_disk.to_path_buf()))
}
}

Expand Down

0 comments on commit dec6420

Please sign in to comment.