remove more "rustdesk" built-in

This commit is contained in:
rustdesk
2024-02-25 13:29:06 +08:00
parent 9ff1dfe019
commit a28c9f8f36
15 changed files with 66 additions and 50 deletions

View File

@@ -158,21 +158,21 @@ pub fn is_installed_daemon(prompt: bool) -> bool {
let Some(install_script) = PRIVILEGES_SCRIPTS_DIR.get_file("install.scpt") else {
return false;
};
let Some(install_script_body) = install_script.contents_utf8() else {
let Some(install_script_body) = install_script.contents_utf8().map(correct_app_name) else {
return false;
};
let Some(daemon_plist) = PRIVILEGES_SCRIPTS_DIR.get_file(&daemon) else {
let Some(daemon_plist) = PRIVILEGES_SCRIPTS_DIR.get_file("daemon.plist") else {
return false;
};
let Some(daemon_plist_body) = daemon_plist.contents_utf8() else {
let Some(daemon_plist_body) = daemon_plist.contents_utf8().map(correct_app_name) else {
return false;
};
let Some(agent_plist) = PRIVILEGES_SCRIPTS_DIR.get_file(&agent) else {
let Some(agent_plist) = PRIVILEGES_SCRIPTS_DIR.get_file("agent.plist") else {
return false;
};
let Some(agent_plist_body) = agent_plist.contents_utf8() else {
let Some(agent_plist_body) = agent_plist.contents_utf8().map(correct_app_name) else {
return false;
};
@@ -213,6 +213,12 @@ pub fn is_installed_daemon(prompt: bool) -> bool {
false
}
fn correct_app_name(s: &str) -> String {
let s = s.replace("rustdesk", &crate::get_app_name().to_lowercase());
let s = s.replace("RustDesk", &crate::get_app_name());
s
}
pub fn uninstall_service(show_new_window: bool) -> bool {
// to-do: do together with win/linux about refactory start/stop service
if !is_installed_daemon(false) {
@@ -222,7 +228,7 @@ pub fn uninstall_service(show_new_window: bool) -> bool {
let Some(script_file) = PRIVILEGES_SCRIPTS_DIR.get_file("uninstall.scpt") else {
return false;
};
let Some(script_body) = script_file.contents_utf8() else {
let Some(script_body) = script_file.contents_utf8().map(correct_app_name) else {
return false;
};
@@ -625,7 +631,7 @@ pub fn handle_application_should_open_untitled_file() {
let x = std::env::args().nth(1).unwrap_or_default();
if x == "--server" || x == "--cm" || x == "--tray" {
if crate::platform::macos::check_main_window() {
allow_err!(crate::ipc::send_url_scheme("rustdesk:".into()));
allow_err!(crate::ipc::send_url_scheme(crate::get_uri_prefix()));
}
}
}

View File

@@ -2408,11 +2408,12 @@ sc start {app_name}
fn run_after_run_cmds(silent: bool) {
let (_, _, _, exe) = get_install_info();
let app = crate::get_app_name().to_lowercase();
if !silent {
log::debug!("Spawn new window");
allow_err!(std::process::Command::new("cmd")
.arg("/c")
.arg("timeout /t 2 & start rustdesk://")
.arg("timeout /t 2 & start {app}://")
.creation_flags(winapi::um::winbase::CREATE_NO_WINDOW)
.spawn());
}