Skip to content

Commit

Permalink
config: Use create config in CONFIG_STRING
Browse files Browse the repository at this point in the history
  • Loading branch information
DashieTM committed Jun 1, 2024
1 parent 6dec1b5 commit c7f9552
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions src/utils/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,18 @@ use std::{fs, io::Read};
use once_cell::sync::Lazy;
use toml::Table;

use crate::{ERROR, LOG};
use crate::{create_config, ERROR, LOG};
#[cfg(debug_assertions)]
use crate::{utils::macros::ErrorLevel, write_log_to_file};

pub static mut CONFIG_STRING: Lazy<String> = Lazy::new(|| {
let base = xdg::BaseDirectories::new();
if let Ok(base) = base {
return base
.get_config_home()
.join("ReSet.toml")
.to_str()
.unwrap()
.to_string();
let config = create_config("reset");
if let Some(config) = config {
config.to_str().unwrap().to_string()
} else {
ERROR!("Failed to get user home", ErrorLevel::Critical);
String::from("")
}
String::from("")
});
#[allow(clippy::declare_interior_mutable_const)]
pub const CONFIG: Lazy<Table> = Lazy::new(parse_config);
Expand Down

0 comments on commit c7f9552

Please sign in to comment.