diff options
author | Jesse Luehrs <doy@tozt.net> | 2022-03-08 19:58:53 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2022-03-08 20:00:46 -0500 |
commit | 3a082edd58ecdf4db31702c6c8487c42227049a3 (patch) | |
tree | 6cdb3a7b635da5b06e82fc91d7ddba618822843a /src/dirs.rs | |
parent | 1abb97cca69e0b513f7499cc7db03ba622b38711 (diff) | |
download | nbsh-3a082edd58ecdf4db31702c6c8487c42227049a3.tar.gz nbsh-3a082edd58ecdf4db31702c6c8487c42227049a3.zip |
parse a history file if available
doesn't do anything with it yet
Diffstat (limited to 'src/dirs.rs')
-rw-r--r-- | src/dirs.rs | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/dirs.rs b/src/dirs.rs index 45674e3..2ffbb33 100644 --- a/src/dirs.rs +++ b/src/dirs.rs @@ -1,9 +1,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 { - let project_dirs = - directories::ProjectDirs::from("", "", "nbsh").unwrap(); - project_dirs.config_dir().to_path_buf() + PROJECT_DIRS.config_dir().to_path_buf() +} + +fn data_dir() -> std::path::PathBuf { + PROJECT_DIRS.data_dir().to_path_buf() } |