git_helpe_rs/file_utils/
config_file.rs

1use std::path::PathBuf;
2
3pub fn get_path_to_config(path: Option<PathBuf>) -> PathBuf {
4    if let Some(path) = path {
5        return path;
6    }
7
8    let mut home = if let Ok(home) = std::env::var("XDG_CONFIG_HOME") {
9        PathBuf::from(home)
10    } else if let Ok(home) = std::env::var("HOME") {
11        PathBuf::from(home)
12    } else {
13        panic!("Couldn't find home directory")
14    };
15    home.push(".git-helpe-rs-config");
16    return home;
17}