From d18810b6125537f0f79534b7f2a64cc81b0c702d Mon Sep 17 00:00:00 2001 From: rustdesk Date: Fri, 3 May 2024 02:13:44 +0800 Subject: [PATCH] fix appimage --cm --- appimage/AppImageBuilder-aarch64.yml | 8 +------- src/common.rs | 18 ++++++++---------- 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/appimage/AppImageBuilder-aarch64.yml b/appimage/AppImageBuilder-aarch64.yml index 534b6727259b..4e0e7fa04cbf 100644 --- a/appimage/AppImageBuilder-aarch64.yml +++ b/appimage/AppImageBuilder-aarch64.yml @@ -12,12 +12,6 @@ script: # desktop file # - sed -i "s/Icon=\/usr\/share\/rustdesk\/files\/rustdesk.png/Icon=rustdesk/g" ./AppDir/usr/share/applications/rustdesk.desktop - rm -rf ./AppDir/usr/share/applications - - touch ./AppDir/start.sh - - echo "#\!/bin/sh" >> ./AppDir/start.sh - - echo "echo \$APPIMAGE" >> ./AppDir/start.sh - - echo "echo \$ARGV0" >> ./AppDir/start.sh - - echo "exec usr/lib/rustdesk/rustdesk" >> ./AppDir/start.sh - - chmod +x ./AppDir/start.sh AppDir: path: ./AppDir app_info: @@ -25,7 +19,7 @@ AppDir: name: rustdesk icon: rustdesk version: 1.2.4 - exec: ./start.sh + exec: usr/lib/rustdesk/rustdesk exec_args: $@ apt: arch: diff --git a/src/common.rs b/src/common.rs index 41b872afc904..25433fa4c9aa 100644 --- a/src/common.rs +++ b/src/common.rs @@ -844,18 +844,16 @@ pub fn refresh_rendezvous_server() { } pub fn run_me>(args: Vec) -> std::io::Result { - #[cfg(not(feature = "appimage"))] - { - let cmd = std::env::current_exe()?; - return std::process::Command::new(cmd).args(&args).spawn(); - } - #[cfg(feature = "appimage")] - { - let appdir = std::env::var("APPDIR").map_err(|_| std::io::ErrorKind::Other)?; + #[cfg(target_os = "linux")] + if let Ok(appdir) = std::env::var("APPDIR") { let appimage_cmd = std::path::Path::new(&appdir).join("AppRun"); - log::info!("path: {:?}", appimage_cmd); - return std::process::Command::new(appimage_cmd).args(&args).spawn(); + if appimage_cmd.exists() { + log::info!("path: {:?}", appimage_cmd); + return std::process::Command::new(appimage_cmd).args(&args).spawn(); + } } + let cmd = std::env::current_exe()?; + return std::process::Command::new(cmd).args(&args).spawn(); } #[inline]