Commit fede5479 authored by Jeremy Soller's avatar Jeremy Soller Committed by Andy Barron
Browse files

Implement Redox support (#24)

parent e3779dcd
......@@ -8,6 +8,11 @@ mod platform {
mod macos;
pub use self::macos::*;
}
#[cfg(target_os="redox")]
mod platform {
mod redox;
pub use self::redox::*;
}
#[cfg(all(unix, not(target_os="macos")))]
mod platform {
mod unix;
......@@ -18,7 +23,7 @@ mod platform {
mod windows;
pub use self::windows::*;
}
#[cfg(not(any(windows, unix, target_os="macos",)))]
#[cfg(not(any(windows, unix, target_os="macos", target_os="redox")))]
mod platform {
mod unknown;
pub use self::unknown::*;
......
use AppDataType::*;
use common::*;
use std::env::home_dir;
use std::path::{Component, PathBuf};
pub const USE_AUTHOR: bool = false;
pub fn get_app_dir(t: AppDataType) -> Result<PathBuf, AppDirsError> {
let dir_base: Result<PathBuf, AppDirsError> = if t.is_shared() {
Ok(Component::RootDir.as_ref().into())
} else {
home_dir().ok_or_else(|| AppDirsError::NotSupported)
};
dir_base.map(|mut path| {
match t {
UserConfig => {
path.push(".config");
},
UserCache => {
path.push(".cache");
},
UserData => {
path.push(".share");
},
SharedConfig => {
path.push("etc");
},
SharedData => {
path.push("share");
}
};
path
})
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment