fix appimage --cm

This commit is contained in:
rustdesk 2024-05-03 02:13:44 +08:00
parent 3c17d713b3
commit d18810b612
2 changed files with 9 additions and 17 deletions

View File

@ -12,12 +12,6 @@ script:
# desktop file # desktop file
# - sed -i "s/Icon=\/usr\/share\/rustdesk\/files\/rustdesk.png/Icon=rustdesk/g" ./AppDir/usr/share/applications/rustdesk.desktop # - 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 - 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: AppDir:
path: ./AppDir path: ./AppDir
app_info: app_info:
@ -25,7 +19,7 @@ AppDir:
name: rustdesk name: rustdesk
icon: rustdesk icon: rustdesk
version: 1.2.4 version: 1.2.4
exec: ./start.sh exec: usr/lib/rustdesk/rustdesk
exec_args: $@ exec_args: $@
apt: apt:
arch: arch:

View File

@ -844,18 +844,16 @@ pub fn refresh_rendezvous_server() {
} }
pub fn run_me<T: AsRef<std::ffi::OsStr>>(args: Vec<T>) -> std::io::Result<std::process::Child> { pub fn run_me<T: AsRef<std::ffi::OsStr>>(args: Vec<T>) -> std::io::Result<std::process::Child> {
#[cfg(not(feature = "appimage"))] #[cfg(target_os = "linux")]
{ if let Ok(appdir) = std::env::var("APPDIR") {
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)?;
let appimage_cmd = std::path::Path::new(&appdir).join("AppRun"); let appimage_cmd = std::path::Path::new(&appdir).join("AppRun");
log::info!("path: {:?}", appimage_cmd); if appimage_cmd.exists() {
return std::process::Command::new(appimage_cmd).args(&args).spawn(); 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] #[inline]