feat: macos, update dmg (#13539)

* feat: macos, update dmg

Signed-off-by: fufesou <linlong1266@gmail.com>

* Update src/platform/macos.rs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* fix: macos update, remove temp update dir

Signed-off-by: fufesou <linlong1266@gmail.com>

* refact: macos update, print

Signed-off-by: fufesou <linlong1266@gmail.com>

---------

Signed-off-by: fufesou <linlong1266@gmail.com>
Co-authored-by: RustDesk <71636191+rustdesk@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
fufesou
2025-11-18 00:30:23 +08:00
committed by GitHub
parent 81f711eb00
commit a6571e71e4
3 changed files with 82 additions and 19 deletions

View File

@@ -300,14 +300,35 @@ pub fn core_main() -> Option<Vec<String>> {
{
use crate::platform;
if args[0] == "--update" {
let _text = match platform::update_me() {
Ok(_) => {
log::info!("{}", translate("Update successfully!".to_string()));
if args.len() > 1 && args[1].ends_with(".dmg") {
// Version check is unnecessary unless downgrading to an older version
// that lacks "update dmg" support. This is a special case since we cannot
// detect the version before extracting the DMG, so we skip the check.
let dmg_path = &args[1];
println!("Updating from DMG: {}", dmg_path);
match platform::update_from_dmg(dmg_path) {
Ok(_) => {
println!("Update process from DMG started successfully.");
// The new process will handle the rest. We can exit.
}
Err(err) => {
eprintln!("Failed to start update from DMG: {}", err);
}
}
Err(err) => {
log::error!("Update failed with error: {err}");
}
};
} else {
println!("Starting update process...");
log::info!("Starting update process...");
let _text = match platform::update_me() {
Ok(_) => {
println!("{}", translate("Update successfully!".to_string()));
log::info!("Update successfully!");
}
Err(err) => {
eprintln!("Update failed with error: {}", err);
log::error!("Update failed with error: {err}");
}
};
}
return None;
}
}