rustdesk 2022-06-13 19:00:25 +08:00
parent 103f114b67
commit f2eaad73a8
3 changed files with 11 additions and 7 deletions

View File

@ -95,13 +95,15 @@ fn main() {
hbb_common::allow_err!(platform::uninstall_me());
hbb_common::allow_err!(platform::install_me(
"desktopicon startmenu",
"".to_owned()
"".to_owned(),
false,
));
return;
} else if args[0] == "--silent-install" {
hbb_common::allow_err!(platform::install_me(
"desktopicon startmenu",
"".to_owned()
"".to_owned(),
true,
));
return;
} else if args[0] == "--extract" {

View File

@ -905,7 +905,7 @@ fn get_after_install(exe: &str) -> String {
", ext=ext, exe=exe, app_name=app_name)
}
pub fn install_me(options: &str, path: String) -> ResultType<()> {
pub fn install_me(options: &str, path: String, silent: bool) -> ResultType<()> {
let uninstall_str = get_uninstall();
let mut path = path.trim_end_matches('\\').to_owned();
let (subkey, _path, start_menu, exe) = get_default_install_info();
@ -1080,9 +1080,11 @@ sc delete {app_name}
);
run_cmds(cmds, false)?;
std::thread::sleep(std::time::Duration::from_millis(2000));
std::process::Command::new(&exe).spawn()?;
std::process::Command::new(&exe).arg("--tray").spawn()?;
std::thread::sleep(std::time::Duration::from_millis(1000));
if !silent {
std::process::Command::new(&exe).spawn()?;
std::process::Command::new(&exe).arg("--tray").spawn()?;
std::thread::sleep(std::time::Duration::from_millis(1000));
}
Ok(())
}

View File

@ -213,7 +213,7 @@ impl UI {
fn install_me(&mut self, _options: String, _path: String) {
#[cfg(windows)]
std::thread::spawn(move || {
allow_err!(crate::platform::windows::install_me(&_options, _path));
allow_err!(crate::platform::windows::install_me(&_options, _path, false));
std::process::exit(0);
});
}