19 lines
516 B
Rust
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;
|
|
}
|