Files
Cultivation/src-tauri/src/admin.rs
fnrir 75f3e829d5 Removed root requirement
Also disabled install_ca_files since this causes crashes when not run as
root
2023-08-18 15:29:40 +02:00

23 lines
506 B
Rust

#[cfg(windows)]
pub fn reopen_as_admin() {
use std::process::{exit, Command};
let install = std::env::current_exe().unwrap();
println!("Opening as admin: {}", install.to_str().unwrap());
Command::new("powershell.exe")
.arg("powershell")
.arg(format!(
"-command \"&{{Start-Process -filepath '{}' -verb runas}}\"",
install.to_str().unwrap()
))
.spawn()
.expect("Error starting exec as admin");
exit(0);
}
#[cfg(target_os = "macos")]
pub fn reopen_as_admin() {}