| @@ -347,7 +347,7 @@ impl WindowManager { |
| 347 |
|
347 |
|
| 348 |
fn try_reload_config(&mut self) -> Result<(), String> { |
348 |
fn try_reload_config(&mut self) -> Result<(), String> { |
| 349 |
let lua_path = |
349 |
let lua_path = |
| 350 |
- self.config.path.take().ok_or( |
350 |
+ self.config.path.as_ref().ok_or( |
| 351 |
"Could not find config file. Config path should've been set while loading", |
351 |
"Could not find config file. Config path should've been set while loading", |
| 352 |
)?; |
352 |
)?; |
| 353 |
|
353 |
|
| @@ -355,7 +355,7 @@ impl WindowManager { |
| 355 |
return Err("Could not find config file, has it been moved?".to_string()); |
355 |
return Err("Could not find config file, has it been moved?".to_string()); |
| 356 |
} |
356 |
} |
| 357 |
|
357 |
|
| 358 |
- let config_str = std::fs::read_to_string(&lua_path) |
358 |
+ let config_str = std::fs::read_to_string(lua_path) |
| 359 |
.map_err(|e| format!("Failed to read config: {}", e))?; |
359 |
.map_err(|e| format!("Failed to read config: {}", e))?; |
| 360 |
|
360 |
|
| 361 |
let config_dir = lua_path.parent(); |
361 |
let config_dir = lua_path.parent(); |
| @@ -363,8 +363,10 @@ impl WindowManager { |
| 363 |
let new_config = crate::config::parse_lua_config(&config_str, config_dir) |
363 |
let new_config = crate::config::parse_lua_config(&config_str, config_dir) |
| 364 |
.map_err(|e| format!("{}", e))?; |
364 |
.map_err(|e| format!("{}", e))?; |
| 365 |
|
365 |
|
|
|
366 |
+ let lua_path = self.config.path.take(); |
|
|
367 |
+ |
| 366 |
self.config = new_config; |
368 |
self.config = new_config; |
| 367 |
- self.config.path = Some(lua_path); |
369 |
+ self.config.path = lua_path; |
| 368 |
self.error_message = None; |
370 |
self.error_message = None; |
| 369 |
|
371 |
|
| 370 |
for bar in &mut self.bars { |
372 |
for bar in &mut self.bars { |