downloading and extracting

This commit is contained in:
SpikeHD
2022-07-24 18:14:18 -07:00
parent 975b04fd0e
commit 36c2302f1b
13 changed files with 143 additions and 28 deletions

View File

@@ -3,7 +3,7 @@ use std::path;
use std::thread;
#[tauri::command]
pub fn unzip(window: tauri::Window, zipfile: String, destpath: String) {
pub fn unzip(window: tauri::Window, zipfile: String, destpath: String, top_level: Option<bool>) {
// Read file TODO: replace test file
let f = match File::open(&zipfile) {
Ok(f) => f,
@@ -21,7 +21,7 @@ pub fn unzip(window: tauri::Window, zipfile: String, destpath: String) {
window.emit("extract_start", &zipfile).unwrap();
match zip_extract::extract(&f, &full_path, true) {
match zip_extract::extract(&f, &full_path, top_level.unwrap_or(false)) {
Ok(_) => {
println!(
"Extracted zip file to: {}",