refactor elevate on macOS
Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
parent
9ecf0e3f89
commit
25f37577c3
@ -186,6 +186,19 @@ fn elevate_install(
|
|||||||
crate::platform::elevate(args)
|
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]
|
#[inline]
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
fn elevate_uninstall(plugin_id: &str) -> ResultType<bool> {
|
fn elevate_uninstall(plugin_id: &str) -> ResultType<bool> {
|
||||||
@ -193,11 +206,20 @@ fn elevate_uninstall(plugin_id: &str) -> ResultType<bool> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
#[cfg(any(target_os = "linux", target_os = "macos"))]
|
#[cfg(target_os = "linux")]
|
||||||
fn elevate_install(plugin_id: &str) -> ResultType<bool> {
|
fn elevate_uninstall(plugin_id: &str) -> ResultType<bool> {
|
||||||
crate::platform::elevate(vec!["--plugin-uninstall", plugin_id])
|
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<()> {
|
pub fn install_plugin(id: &str) -> ResultType<()> {
|
||||||
match PLUGIN_INFO.lock().unwrap().get(id) {
|
match PLUGIN_INFO.lock().unwrap().get(id) {
|
||||||
Some(plugin) => {
|
Some(plugin) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user