diff --git a/Cargo.toml b/Cargo.toml index 4084026..6802d55 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,5 +10,4 @@ maintenance = { status = "actively-developed" } keywords = ["xdg", "basedir", "app_dirs", "path", "folder"] [dependencies] -cfg-if = "=0.1.9" dirs-sys = "0.3.5" diff --git a/src/lib.rs b/src/lib.rs index 669f73d..e3c2232 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -13,26 +13,35 @@ #![deny(missing_docs)] -#[macro_use] -extern crate cfg_if; - use std::path::PathBuf; -cfg_if! { - if #[cfg(target_os = "windows")] { - mod win; - use win as sys; - } else if #[cfg(any(target_os = "macos", target_os = "ios"))] { - mod mac; - use mac as sys; - } else if #[cfg(target_arch = "wasm32")] { - mod wasm; - use wasm as sys; - } else { - mod lin; - use lin as sys; - } -} +#[cfg(target_os = "windows")] +mod win; +#[cfg(target_os = "windows")] +use win as sys; + +#[cfg(any(target_os = "macos", target_os = "ios"))] +mod mac; +#[cfg(any(target_os = "macos", target_os = "ios"))] +use mac as sys; + +#[cfg(target_arch = "wasm32")] +mod wasm; +#[cfg(target_arch = "wasm32")] +use wasm as sys; + +#[cfg(not(any( + target_os = "windows", + target_os = "macos", target_os = "ios", + target_arch = "wasm32" +)))] +mod lin; +#[cfg(not(any( + target_os = "windows", + target_os = "macos", target_os = "ios", + target_arch = "wasm32" +)))] +use lin as sys; /// Returns the path to the user's home directory. ///