#[derive(Debug, thiserror::Error)]
pub enum Error {
#[cfg(windows)]
#[error("Windows related error: {0}")]
WindowsError(#[from] super::win::Error),
}
#[allow(clippy::module_name_repetitions)]
pub fn is_root() -> Result<bool, Error> {
cfg_if::cfg_if! {
if #[cfg(windows)] {
let root = crate::win::root::is_elevated()?;
} else if #[cfg(unix)] {
let root = crate::unix::root::is_root();
}
};
Ok(root)
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_is_root() {
assert_eq!(is_root().unwrap(), is_root::is_root());
}
}