feat(env): customizable config file location

This commit is contained in:
Songtronix 2019-10-22 15:53:05 +02:00
parent 4815a096fd
commit e8a077a5d6

View File

@ -281,6 +281,14 @@ impl Settings {
}
fn get_settings_path() -> PathBuf {
if let Some(val) = std::env::var_os("VOXYGEN_CONFIG") {
let settings = PathBuf::from(val).join("settings.ron");
if settings.exists() || settings.parent().map(|x| x.exists()).unwrap_or(false) {
return settings;
}
log::warn!("VOXYGEN_CONFIG points to invalid path.");
}
let proj_dirs = ProjectDirs::from("net", "veloren", "voxygen")
.expect("System's $HOME directory path not found!");
proj_dirs