Skip to content

Commit

Permalink
[rust] Use shell command to move extracted Edge to cache
Browse files Browse the repository at this point in the history
  • Loading branch information
bonigarcia committed Mar 25, 2024
1 parent 94b2c9b commit 8ab0b61
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions rust/src/files.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ pub fn uncompress(
} else if extension.eq_ignore_ascii_case(EXE) {
uncompress_sfx(compressed_file, target, log)?
} else if extension.eq_ignore_ascii_case(DEB) {
uncompress_deb(compressed_file, target, log, volume.unwrap_or_default())?
uncompress_deb(compressed_file, target, log, os, volume.unwrap_or_default())?
} else if extension.eq_ignore_ascii_case(MSI) {
install_msi(compressed_file, log, os)?
} else if extension.eq_ignore_ascii_case(XML) || extension.eq_ignore_ascii_case(HTML) {
Expand Down Expand Up @@ -264,6 +264,7 @@ pub fn uncompress_deb(
compressed_file: &str,
target: &Path,
log: &Logger,
os: &str,
label: &str,
) -> Result<(), Error> {
let zip_parent = Path::new(compressed_file).parent().unwrap();
Expand All @@ -279,13 +280,17 @@ pub fn uncompress_deb(

let zip_parent_str = path_to_string(zip_parent);
let target_str = path_to_string(target);
let opt_edge_str = format!("{}/opt/microsoft/{}", zip_parent_str, label);
let opt_edge_str = format!(
"mv {}/opt/microsoft/{} {}",
zip_parent_str, label, target_str
);
let command = Command::new_single(opt_edge_str.clone());
log.trace(format!(
"Moving extracted files and folders from {} to {}",
opt_edge_str, target_str
));
create_parent_path_if_not_exists(target)?;
fs::rename(&opt_edge_str, &target_str)?;
run_shell_command_by_os(os, command)?;

Ok(())
}
Expand Down

0 comments on commit 8ab0b61

Please sign in to comment.