diff --git a/package-lock.json b/package-lock.json index e96ea5a..a1fd806 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "zinnia", - "version": "0.1.2", + "version": "0.1.4", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "zinnia", - "version": "0.1.2", + "version": "0.1.4", "dependencies": { "@tauri-apps/api": "^2.0.0", "@tauri-apps/plugin-dialog": "^2.6.0", diff --git a/package.json b/package.json index 6b32e04..f9baa5d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "zinnia", - "version": "0.1.3", + "version": "0.1.4", "private": true, "description": "Cross-platform 7z GUI built with Tauri.", "type": "module", diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 5824688..002a5cf 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -680,6 +680,31 @@ fn cancel_7z(state: tauri::State<'_, RunningProcess>) -> Result<(), String> { #[cfg(windows)] const ARCHIVE_EXTENSIONS: &[&str] = SUPPORTED_ARCHIVE_EXTENSIONS; +#[cfg(windows)] +fn notify_shell_association_changed() { + #[allow(non_snake_case)] + unsafe extern "system" { + fn SHChangeNotify( + wEventId: u32, + uFlags: u32, + dwItem1: *const std::ffi::c_void, + dwItem2: *const std::ffi::c_void, + ); + } + + const SHCNE_ASSOCCHANGED: u32 = 0x0800_0000; + const SHCNF_IDLIST: u32 = 0x0000; + + unsafe { + SHChangeNotify( + SHCNE_ASSOCCHANGED, + SHCNF_IDLIST, + std::ptr::null(), + std::ptr::null(), + ); + } +} + #[tauri::command] fn register_windows_context_menu() -> Result<(), String> { #[cfg(windows)] @@ -699,7 +724,7 @@ fn register_windows_context_menu() -> Result<(), String> { .create_subkey("Software\\Classes") .map_err(|e| e.to_string())?; - let icon_value = format!("{},0", exe_str); + let icon_value = format!("\"{}\",0", exe_str); let compress_entries = [ ("*\\shell\\Zinnia", "Compress with Zinnia"), ("Directory\\shell\\Zinnia", "Compress folder with Zinnia"), @@ -758,6 +783,7 @@ fn register_windows_context_menu() -> Result<(), String> { .map_err(|e| e.to_string())?; } + notify_shell_association_changed(); Ok(()) } @@ -807,6 +833,7 @@ fn unregister_windows_context_menu() -> Result<(), String> { Err(e) => return Err(format!("Failed to remove Zinnia.Archive: {}", e)), } + notify_shell_association_changed(); Ok(()) } diff --git a/src/index.html b/src/index.html index 454a45c..7e369bd 100644 --- a/src/index.html +++ b/src/index.html @@ -53,8 +53,8 @@

Settings

- Check for updates on startup - Automatically check for new versions when the app opens. + Check and automatically download updates on startup + Automatically checks for updates when the app opens and downloads them in the background.