aboutsummaryrefslogtreecommitdiff
path: root/src/paths.rs
blob: f219dc41235f7c807625bdcf03a7d22a78fced62 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
//! Module to resolve application-specific paths.
use super::APP_NAME;

use std::path::PathBuf;

/// Returns the path that should be used for the cache.
pub fn cache_path() -> PathBuf {
    let mut cache_path = dirs::cache_dir().unwrap();
    cache_path.push(APP_NAME);
    cache_path
}

/// Returns the path that should be used for the REPL history.
pub fn history_path() -> Option<PathBuf> {
    let mut config_path = dirs::config_dir()?;
    config_path.push(APP_NAME);
    config_path.push("history");
    Some(config_path)
}