Discards files that are not TOML
This commit is contained in:
parent
e657e55931
commit
9201e34a00
1 changed files with 6 additions and 4 deletions
10
src/main.rs
10
src/main.rs
|
@ -15,10 +15,12 @@ async fn main() {
|
|||
let config_path = std::fs::read_dir(format!("{}/.config/makima", home::home_dir().unwrap().display())).unwrap();
|
||||
let mut config_files: Vec<Config> = Vec::new();
|
||||
for file in config_path {
|
||||
let filename: String = file.as_ref().unwrap().file_name().into_string().unwrap()
|
||||
.split(".toml").collect::<Vec<&str>>()[0].to_string();
|
||||
let config_file: Config = Config::new_from_file(file.unwrap().path().to_str().unwrap(), filename);
|
||||
config_files.push(config_file);
|
||||
let filename: String = file.as_ref().unwrap().file_name().into_string().unwrap();
|
||||
if filename.contains(".toml") {
|
||||
let name: String = filename.split(".toml").collect::<Vec<&str>>()[0].to_string();
|
||||
let config_file: Config = Config::new_from_file(file.unwrap().path().to_str().unwrap(), name);
|
||||
config_files.push(config_file);
|
||||
}
|
||||
}
|
||||
let tasks: Vec<JoinHandle<()>> = Vec::new();
|
||||
start_monitoring_udev(config_files, tasks).await;
|
||||
|
|
Loading…
Add table
Reference in a new issue