Fix extract to work with nested directories

This commit is contained in:
Sarah Jamie Lewis 2023-06-15 11:47:28 -07:00
parent 7045f99aa6
commit c021d92bad
1 changed files with 4 additions and 2 deletions

View File

@ -32,7 +32,7 @@ where
let mut buf = vec![0; 8192]; let mut buf = vec![0; 8192];
match reader.read(&mut buf) { match reader.read(&mut buf) {
Err(err) => { Err(err) => {
println!("{}] Error reading from stream: {}", line!(), err); println!("Error reading from stream: {}", err);
break; break;
} }
Ok(got) => { Ok(got) => {
@ -63,6 +63,7 @@ impl QemuProcess {
"nic", "nic",
"-net", "-net",
"user", "user",
"-accel","kvm",
"-drive", "-drive",
format!("if=virtio,format=qcow2,file={}", path).as_str(), format!("if=virtio,format=qcow2,file={}", path).as_str(),
"-drive", "-drive",
@ -187,7 +188,8 @@ impl QemuProcess {
let mut file = vec![]; let mut file = vec![];
conn.read_to_end(&mut file) conn.read_to_end(&mut file)
.expect("could not read contents of file"); .expect("could not read contents of file");
fs::write(file_to_extract_clone.as_str(), file).expect("could not write extracted file to "); let extracted_file_name = file_to_extract_clone.split("/").last().unwrap_or("extract_file");
fs::write(extracted_file_name, file).expect("could not write extracted file to ");
} }
Err(_) => {} Err(_) => {}
} }