use std::path;
use app_dirs;
use errors::*;
const APP_INFO: app_dirs::AppInfo = app_dirs::AppInfo {
name: "borg-hive",
author: "borg-hive",
};
pub fn config_file() -> Result<path::PathBuf> {
Ok(app_root()?.join("config.json"))
}
pub fn log_file() -> Result<path::PathBuf> {
Ok(app_root()?.join("log.txt"))
}
pub fn state_file() -> Result<path::PathBuf> {
Ok(app_root()?.join("state.json"))
}
fn app_root() -> Result<path::PathBuf> {
Ok(app_dirs::app_root(
app_dirs::AppDataType::UserData,
&APP_INFO,
).chain_err(
|| "cannot determine the application's data directory",
)?)
}