mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-02-17 22:11:30 +08:00
Merge pull request #4392 from fufesou/refact/macos_elevate
Refact/macos elevate
This commit is contained in:
@@ -173,7 +173,7 @@ fn elevate_install(
|
||||
crate::platform::elevate(&args)
|
||||
}
|
||||
|
||||
#[cfg(any(target_os = "linux", target_os = "macos"))]
|
||||
#[cfg(target_os = "linux")]
|
||||
fn elevate_install(
|
||||
plugin_id: &str,
|
||||
plugin_url: &str,
|
||||
@@ -186,6 +186,19 @@ fn elevate_install(
|
||||
crate::platform::elevate(args)
|
||||
}
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
fn elevate_install(
|
||||
plugin_id: &str,
|
||||
plugin_url: &str,
|
||||
same_plugin_exists: bool,
|
||||
) -> ResultType<bool> {
|
||||
let mut args = vec!["--plugin-install", plugin_id];
|
||||
if !same_plugin_exists {
|
||||
args.push(&plugin_url);
|
||||
}
|
||||
crate::platform::elevate(args, "RustDesk wants to install then plugin")
|
||||
}
|
||||
|
||||
#[inline]
|
||||
#[cfg(target_os = "windows")]
|
||||
fn elevate_uninstall(plugin_id: &str) -> ResultType<bool> {
|
||||
@@ -193,11 +206,20 @@ fn elevate_uninstall(plugin_id: &str) -> ResultType<bool> {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
#[cfg(any(target_os = "linux", target_os = "macos"))]
|
||||
fn elevate_install(plugin_id: &str) -> ResultType<bool> {
|
||||
#[cfg(target_os = "linux")]
|
||||
fn elevate_uninstall(plugin_id: &str) -> ResultType<bool> {
|
||||
crate::platform::elevate(vec!["--plugin-uninstall", plugin_id])
|
||||
}
|
||||
|
||||
#[inline]
|
||||
#[cfg(target_os = "macos")]
|
||||
fn elevate_uninstall(plugin_id: &str) -> ResultType<bool> {
|
||||
crate::platform::elevate(
|
||||
vec!["--plugin-uninstall", plugin_id],
|
||||
"RustDesk wants to uninstall the plugin",
|
||||
)
|
||||
}
|
||||
|
||||
pub fn install_plugin(id: &str) -> ResultType<()> {
|
||||
match PLUGIN_INFO.lock().unwrap().get(id) {
|
||||
Some(plugin) => {
|
||||
|
||||
Reference in New Issue
Block a user