1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
#[cfg(target_os = "windows")] pub fn is_running_as_admin() -> bool { false } #[cfg(not(target_os = "windows"))] pub fn is_running_as_admin() -> bool { unsafe { libc::geteuid() == 0 } } pub fn get_system_version() -> String { #[cfg(target_os = "windows")] { format!("Windows {}", std::env::consts::ARCH) } #[cfg(not(target_os = "windows"))] { format!("Linux {}", std::env::consts::ARCH) } }