sort laws by filename

This commit is contained in:
philipp 2024-02-19 18:42:07 +01:00
parent ee78842153
commit f34fd82b3f

View File

@ -91,13 +91,16 @@ fn get_content(config_path: &str) -> (String, String) {
}
fn main() {
let configs = fs::read_dir("./laws").expect("No folder with config files");
let mut configs: Vec<_> = fs::read_dir("./laws")
.unwrap()
.map(|r| r.unwrap())
.collect();
configs.sort_by_key(|dir| dir.path());
fs::create_dir_all("./output").unwrap();
let mut li_of_files = String::new();
for config in configs {
let config = config.unwrap();
let filename = config.file_name().into_string().unwrap();
//TODO: use proper logic...
let law_name = filename.replace(".toml", "");