mirror of
https://github.com/MeexReay/bRAC.git
synced 2025-05-06 13:38:04 +03:00
fix config path in minimal
This commit is contained in:
parent
9878a4f043
commit
f8a0964272
@ -113,36 +113,39 @@ pub fn load_config(path: PathBuf) -> Config {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_config_path() -> PathBuf {
|
pub fn get_config_path() -> PathBuf {
|
||||||
let home_dir = PathBuf::from_str(".").ok();
|
let mut config_dir = PathBuf::from_str(".").unwrap();
|
||||||
|
|
||||||
#[cfg(feature = "homedir")]
|
#[cfg(feature = "homedir")]
|
||||||
let home_dir = {
|
if let Some(dir) = {
|
||||||
use homedir::my_home;
|
let home_dir = {
|
||||||
my_home().ok().flatten()
|
use homedir::my_home;
|
||||||
};
|
my_home().ok().flatten()
|
||||||
|
};
|
||||||
|
|
||||||
#[allow(unused_variables)]
|
#[cfg(target_os = "linux")]
|
||||||
let config_path = Path::new("config.yml").to_path_buf();
|
let config_dir = {
|
||||||
|
let home_dir = home_dir.map(|o| o.join("bRAC"));
|
||||||
|
home_dir.map(|o| o.join(".config"))
|
||||||
|
};
|
||||||
|
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "macos")]
|
||||||
let config_path = {
|
let config_dir = {
|
||||||
let home_dir = home_dir.expect("Config find path error");
|
let home_dir = home_dir.map(|o| o.join("bRAC"));
|
||||||
home_dir.join(".config").join("bRAC").join("config.yml")
|
home_dir.map(|o| o.join(".config"))
|
||||||
};
|
};
|
||||||
|
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "windows")]
|
||||||
let config_path = {
|
let config_dir = {
|
||||||
let home_dir = home_dir.expect("Config find path error");
|
let appdata = env::var("APPDATA").map(|o| o.join("bRAC"));
|
||||||
home_dir.join(".config").join("bRAC").join("config.yml")
|
Path::new(&appdata)
|
||||||
};
|
};
|
||||||
|
|
||||||
#[cfg(target_os = "windows")]
|
config_dir
|
||||||
let config_path = {
|
} {
|
||||||
let appdata = env::var("APPDATA").expect("Config find path error");
|
config_dir = dir;
|
||||||
Path::new(&appdata).join("bRAC").join("config.yml")
|
}
|
||||||
};
|
|
||||||
|
|
||||||
config_path
|
config_dir.join("config.yml")
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Parser, Debug)]
|
#[derive(Parser, Debug)]
|
||||||
|
Loading…
Reference in New Issue
Block a user