Skip parsing dotfiles and non-toml files

This commit is contained in:
cyber-sushi 2024-04-06 20:21:19 +02:00
parent a5d84258d3
commit edeaa5d2d2

View file

@ -17,7 +17,7 @@ async fn main() {
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();
if filename.contains(".toml") {
if filename.ends_with(".toml") && !filename.starts_with(".") {
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);