copy broker when update
Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
parent
ba4bc3a645
commit
7dec4f8a04
@ -881,23 +881,35 @@ fn get_install_info_with_subkey(subkey: String) -> (String, String, String, Stri
|
|||||||
(subkey, path, start_menu, exe)
|
(subkey, path, start_menu, exe)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn copy_exe_cmd(src_exe: &str, _exe: &str, _path: &str) -> String {
|
pub fn copy_exe_cmd(src_exe: &str, _exe: &str, path: &str) -> String {
|
||||||
#[cfg(feature = "flutter")]
|
#[cfg(feature = "flutter")]
|
||||||
return format!(
|
let main_exe = format!(
|
||||||
"XCOPY \"{}\" \"{}\" /Y /E /H /C /I /K /R /Z",
|
"XCOPY \"{}\" \"{}\" /Y /E /H /C /I /K /R /Z",
|
||||||
PathBuf::from(src_exe)
|
PathBuf::from(src_exe)
|
||||||
.parent()
|
.parent()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.to_string_lossy()
|
.to_string_lossy()
|
||||||
.to_string(),
|
.to_string(),
|
||||||
_path
|
path
|
||||||
);
|
);
|
||||||
#[cfg(not(feature = "flutter"))]
|
#[cfg(not(feature = "flutter"))]
|
||||||
return format!(
|
let main_exe = format!(
|
||||||
"copy /Y \"{src_exe}\" \"{exe}\"",
|
"copy /Y \"{src_exe}\" \"{exe}\"",
|
||||||
src_exe = src_exe,
|
src_exe = src_exe,
|
||||||
exe = _exe
|
exe = _exe
|
||||||
);
|
);
|
||||||
|
|
||||||
|
return format!(
|
||||||
|
"
|
||||||
|
{main_exe}
|
||||||
|
copy /Y \"{ORIGIN_PROCESS_EXE}\" \"{path}\\{broker_exe}\"
|
||||||
|
\"{src_exe}\" --extract \"{path}\"
|
||||||
|
",
|
||||||
|
main_exe = main_exe,
|
||||||
|
path = path,
|
||||||
|
ORIGIN_PROCESS_EXE = crate::ui::win_privacy::ORIGIN_PROCESS_EXE,
|
||||||
|
broker_exe = crate::ui::win_privacy::INJECTED_PROCESS_EXE,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn update_me() -> ResultType<()> {
|
pub fn update_me() -> ResultType<()> {
|
||||||
@ -910,14 +922,11 @@ pub fn update_me() -> ResultType<()> {
|
|||||||
taskkill /F /IM {broker_exe}
|
taskkill /F /IM {broker_exe}
|
||||||
taskkill /F /IM {app_name}.exe /FI \"PID ne {cur_pid}\"
|
taskkill /F /IM {app_name}.exe /FI \"PID ne {cur_pid}\"
|
||||||
{copy_exe}
|
{copy_exe}
|
||||||
\"{src_exe}\" --extract \"{path}\"
|
|
||||||
sc start {app_name}
|
sc start {app_name}
|
||||||
{lic}
|
{lic}
|
||||||
",
|
",
|
||||||
src_exe = src_exe,
|
|
||||||
copy_exe = copy_exe_cmd(&src_exe, &exe, &path),
|
copy_exe = copy_exe_cmd(&src_exe, &exe, &path),
|
||||||
broker_exe = crate::ui::win_privacy::INJECTED_PROCESS_EXE,
|
broker_exe = crate::ui::win_privacy::INJECTED_PROCESS_EXE,
|
||||||
path = path,
|
|
||||||
app_name = crate::get_app_name(),
|
app_name = crate::get_app_name(),
|
||||||
lic = register_licence(),
|
lic = register_licence(),
|
||||||
cur_pid = get_current_pid(),
|
cur_pid = get_current_pid(),
|
||||||
@ -1091,8 +1100,6 @@ if exist \"{tmp_path}\\{app_name} Tray.lnk\" del /f /q \"{tmp_path}\\{app_name}
|
|||||||
chcp 65001
|
chcp 65001
|
||||||
md \"{path}\"
|
md \"{path}\"
|
||||||
{copy_exe}
|
{copy_exe}
|
||||||
copy /Y \"{ORIGIN_PROCESS_EXE}\" \"{path}\\{broker_exe}\"
|
|
||||||
\"{src_exe}\" --extract \"{path}\"
|
|
||||||
reg add {subkey} /f
|
reg add {subkey} /f
|
||||||
reg add {subkey} /f /v DisplayIcon /t REG_SZ /d \"{exe}\"
|
reg add {subkey} /f /v DisplayIcon /t REG_SZ /d \"{exe}\"
|
||||||
reg add {subkey} /f /v DisplayName /t REG_SZ /d \"{app_name}\"
|
reg add {subkey} /f /v DisplayName /t REG_SZ /d \"{app_name}\"
|
||||||
@ -1123,10 +1130,7 @@ sc delete {app_name}
|
|||||||
",
|
",
|
||||||
uninstall_str=uninstall_str,
|
uninstall_str=uninstall_str,
|
||||||
path=path,
|
path=path,
|
||||||
src_exe=src_exe,
|
|
||||||
exe=exe,
|
exe=exe,
|
||||||
ORIGIN_PROCESS_EXE = crate::ui::win_privacy::ORIGIN_PROCESS_EXE,
|
|
||||||
broker_exe=crate::ui::win_privacy::INJECTED_PROCESS_EXE,
|
|
||||||
subkey=subkey,
|
subkey=subkey,
|
||||||
app_name=crate::get_app_name(),
|
app_name=crate::get_app_name(),
|
||||||
version=crate::VERSION,
|
version=crate::VERSION,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user