aboutsummaryrefslogtreecommitdiff
path: root/src/utils.rs
diff options
context:
space:
mode:
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();