summaryrefslogtreecommitdiffstats
path: root/src/dirs.rs
blob: 2ffbb33c40e4e617f7ff4ff5683f2cec75e79fe5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
static PROJECT_DIRS: once_cell::sync::Lazy<directories::ProjectDirs> =
    once_cell::sync::Lazy::new(|| {
        directories::ProjectDirs::from("", "", "nbsh").unwrap()
    });

pub fn config_file() -> std::path::PathBuf {
    config_dir().join("config.toml")
}

pub fn history_file() -> std::path::PathBuf {
    data_dir().join("history")
}

fn config_dir() -> std::path::PathBuf {
    PROJECT_DIRS.config_dir().to_path_buf()
}

fn data_dir() -> std::path::PathBuf {
    PROJECT_DIRS.data_dir().to_path_buf()
}