+
+ pub fn read_config_file() -> Result<String, Error> {
+ Ok(fs::read_to_string(CONFIG_FILE)?)
+ }
+
+ pub fn save_config_file(data: &str) -> Result<String, Error> {
+ fs::write(CONFIG_FILE, data)?;
+
+ // Reload the new settings
+ // From https://stackoverflow.com/questions/29654927/how-do-i-assign-a-string-to-a-mutable-static-variable/47181804#47181804
+ let mut new_settings = SETTINGS.write().unwrap();
+ *new_settings = match Settings::init() {
+ Ok(c) => c,
+ Err(e) => panic!("{}", e),
+ };
+
+ Self::read_config_file()
+ }