diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index d51bb42..f268f5a 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -2091,12 +2091,6 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" -[[package]] -name = "minisign-verify" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "933dca44d65cdd53b355d0b73d380a2ff5da71f87f036053188bf1eab6a19881" - [[package]] name = "miniz_oxide" version = "0.5.1" @@ -3860,7 +3854,6 @@ checksum = "a34cef4a0ebee0230baaa319b1709c4336f4add550149d2b005a9a5dc5d33617" dependencies = [ "anyhow", "attohttpc", - "base64", "bincode", "cocoa", "dirs-next", @@ -3874,7 +3867,6 @@ dependencies = [ "heck 0.4.0", "http", "ignore", - "minisign-verify", "notify-rust", "objc", "once_cell", @@ -3906,7 +3898,6 @@ dependencies = [ "webkit2gtk", "webview2-com", "windows 0.30.0", - "zip 0.6.2", ] [[package]] diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 78b766f..9e70763 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -16,7 +16,7 @@ tauri-build = { version = "1.0.0-rc.8", features = [] } [dependencies] serde = { version = "1.0", features = ["derive"] } -tauri = { version = "1.0.0-rc.9", features = ["api-all", "updater"] } +tauri = { version = "1.0.0-rc.9", features = ["api-all"] } # Access system process info. sysinfo = "0.23.12" diff --git a/src-tauri/src/file_helpers.rs b/src-tauri/src/file_helpers.rs index ce59454..c47f63b 100644 --- a/src-tauri/src/file_helpers.rs +++ b/src-tauri/src/file_helpers.rs @@ -27,4 +27,9 @@ pub fn dir_exists(path: &str) -> bool { #[tauri::command] pub fn dir_is_empty(path: &str) -> bool { return fs::read_dir(&path).unwrap().count() == 0; +} + +#[tauri::command] +pub fn dir_delete(path: &str) { + fs::remove_dir_all(path).unwrap(); } \ No newline at end of file diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 7bd2cbb..19fe467 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -59,6 +59,7 @@ fn main() { file_helpers::rename, file_helpers::dir_exists, file_helpers::dir_is_empty, + file_helpers::dir_delete, downloader::download_file, downloader::stop_download, lang::get_lang, diff --git a/src/ui/components/menu/Downloads.tsx b/src/ui/components/menu/Downloads.tsx index 4fdff7c..8bd7e2f 100644 --- a/src/ui/components/menu/Downloads.tsx +++ b/src/ui/components/menu/Downloads.tsx @@ -73,7 +73,9 @@ export default class Downloads extends React.Component { if (gc_path) { const resources_exist: boolean = await invoke('dir_exists', { path: path + '\\resources' - }) + }) as boolean && !(await invoke('dir_is_empty', { + path: path + '\\resources' + })) as boolean this.setState({ grasscutter_set: gc_path !== '', @@ -153,7 +155,7 @@ export default class Downloads extends React.Component { if (await invoke('dir_exists', { path: folder + '\\resources' })) { - await invoke('delete_dir', { + await invoke('dir_delete', { path: folder + '\\resources' }) }