diff options
-rw-r--r-- | src/utils.rs | 2 |
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 @@ | |||
1 | use cursive::theme::{BaseColor, Color}; | 1 | use cursive::theme::{BaseColor, Color}; |
2 | use directories::ProjectDirs; | 2 | use directories::ProjectDirs; |
3 | use std::fs; | ||
3 | use std::path::{Path, PathBuf}; | 4 | use std::path::{Path, PathBuf}; |
4 | 5 | ||
5 | pub struct AppConfig { | 6 | pub struct AppConfig { |
@@ -36,6 +37,7 @@ pub fn load_configuration_file() -> AppConfig { | |||
36 | pub fn data_file() -> PathBuf { | 37 | pub 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 { |