Files
Alma/src/utils/folder.rs
2023-03-15 16:22:19 +01:00

19 lines
516 B
Rust

use std::path::Path;
const APPLICATION_SUBFOLDER_NAME: &str = "alma";
pub fn get_config_home_path() -> String {
let config_home_path = std::env::var("XDG_CONFIG_HOME")
.map_or_else(
|_| {
let home_path = std::env::var("HOME").unwrap();
Path::new(&home_path).join(".config")
},
|c| Path::new(&c).to_path_buf(),
)
.join(APPLICATION_SUBFOLDER_NAME)
.display()
.to_string();
return config_home_path;
}