aboutsummaryrefslogtreecommitdiff
path: root/src/utils.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils.rs')
-rw-r--r--src/utils.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/utils.rs b/src/utils.rs
index ab7e7ef..d23f70d 100644
--- a/src/utils.rs
+++ b/src/utils.rs
@@ -1,5 +1,6 @@
1use cursive::theme::{BaseColor, Color}; 1use cursive::theme::{BaseColor, Color};
2use directories::ProjectDirs; 2use directories::ProjectDirs;
3use std::fs;
3use std::path::{Path, PathBuf}; 4use std::path::{Path, PathBuf};
4 5
5pub struct AppConfig { 6pub struct AppConfig {
@@ -36,6 +37,7 @@ pub fn load_configuration_file() -> AppConfig {
36pub fn data_file() -> PathBuf { 37pub fn data_file() -> PathBuf {
37 if let Some(proj_dirs) = ProjectDirs::from("rs", "nerdypepper", "dijo") { 38 if let Some(proj_dirs) = ProjectDirs::from("rs", "nerdypepper", "dijo") {
38 let mut data_file = PathBuf::from(proj_dirs.data_dir()); 39 let mut data_file = PathBuf::from(proj_dirs.data_dir());
40 fs::create_dir_all(&data_file);
39 data_file.push("habit_record.json"); 41 data_file.push("habit_record.json");
40 return data_file; 42 return data_file;
41 } else { 43 } else {