From cc3bc6ca258964c5254ecc8e83fecfe56b514d26 Mon Sep 17 00:00:00 2001 From: Joel Date: Mon, 18 Nov 2024 11:49:27 +1300 Subject: [PATCH] Fixed linting --- plugins/updater/src/updater.rs | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/plugins/updater/src/updater.rs b/plugins/updater/src/updater.rs index bf86816d..d2e381b0 100644 --- a/plugins/updater/src/updater.rs +++ b/plugins/updater/src/updater.rs @@ -840,9 +840,15 @@ impl Update { /// MacOS #[cfg(target_os = "macos")] impl Update { + /// ### Expected structure: + /// ├── [AppName]_[version]_x64.app.tar.gz # GZ generated by tauri-bundler + /// │ └──[AppName].app # Main application + /// │ └── Contents # Application contents... + /// │ └── ... + /// └── ... fn install_inner(&self, bytes: &[u8]) -> Result<()> { use flate2::read::GzDecoder; - + let cursor = Cursor::new(bytes); let mut extracted_files: Vec = Vec::new(); @@ -850,7 +856,7 @@ impl Update { let tmp_backup_dir = tempfile::Builder::new() .prefix("tauri_current_app") .tempdir()?; - + let tmp_extract_dir = tempfile::Builder::new() .prefix("tauri_updated_app") .tempdir()?; @@ -878,7 +884,10 @@ impl Update { } // Try to move the current app to backup - let move_result = std::fs::rename(&self.extract_path, tmp_backup_dir.path().join("current_app")); + let move_result = std::fs::rename( + &self.extract_path, + tmp_backup_dir.path().join("current_app"), + ); let need_authorization = if let Err(err) = move_result { if err.kind() == std::io::ErrorKind::PermissionDenied { true @@ -897,10 +906,10 @@ impl Update { src = self.extract_path.display(), new = tmp_extract_dir.path().display() ); - + let mut osascript = std::process::Command::new("osascript"); osascript.arg("-e").arg(script); - + let status = osascript.status()?; if !status.success() { std::fs::remove_dir_all(tmp_extract_dir.path()).ok();