aboutsummaryrefslogtreecommitdiff
path: root/src/utils.rs
diff options
context:
space:
mode:
authorAkshay <[email protected]>2021-02-21 05:13:32 +0000
committerAkshay <[email protected]>2021-02-21 05:13:32 +0000
commit38d9dfee224ebcd088c0ebecd9e1243994eea409 (patch)
tree1215766f07b1c2eaf68f20aba284e710eb9a24a3 /src/utils.rs
parentad5bf181a176e64c9f70a292cad870e6e8110f09 (diff)
parent53f7a679a0cf7a510de13d67cf370988f71c0d08 (diff)
Merge branch 'cursor' into master
Diffstat (limited to 'src/utils.rs')
-rw-r--r--src/utils.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/utils.rs b/src/utils.rs
index 2453aa6..f5a25c8 100644
--- a/src/utils.rs
+++ b/src/utils.rs
@@ -102,12 +102,12 @@ pub fn load_configuration_file() -> AppConfig {
102 if let Ok(ref mut f) = File::open(&cf) { 102 if let Ok(ref mut f) = File::open(&cf) {
103 let mut j = String::new(); 103 let mut j = String::new();
104 f.read_to_string(&mut j); 104 f.read_to_string(&mut j);
105 return toml::from_str(&j).unwrap(); 105 return toml::from_str(&j).unwrap_or_else(|e| panic!("Invalid config file: `{}`", e));
106 } else { 106 } else {
107 if let Ok(dc) = toml::to_string(&AppConfig::default()) { 107 if let Ok(dc) = toml::to_string(&AppConfig::default()) {
108 match OpenOptions::new().create(true).write(true).open(&cf) { 108 match OpenOptions::new().create(true).write(true).open(&cf) {
109 Ok(ref mut file) => file.write(dc.as_bytes()).unwrap(), 109 Ok(ref mut file) => file.write(dc.as_bytes()).unwrap(),
110 Err(_) => 0, 110 Err(_) => panic!("Unable to write config file to disk!"),
111 }; 111 };
112 } 112 }
113 return Default::default(); 113 return Default::default();