aboutsummaryrefslogtreecommitdiff
path: root/src/utils.rs
diff options
context:
space:
mode:
authorAkshay <[email protected]>2020-07-10 18:16:53 +0100
committerAkshay <[email protected]>2020-07-10 18:16:53 +0100
commitb414a7ce0732b70560f259bf88e4cdce4c555590 (patch)
treeaa857d1b5b927a34dc4279a59d276cf70c675c2e /src/utils.rs
parent27a925262bfd4a70f251226c17b43749b9fd81bb (diff)
i dun an oopsie
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 {