From 01449b185034e1bf208c9b4bcc3b188a08c8fc2b Mon Sep 17 00:00:00 2001 From: Quaternions Date: Tue, 12 Sep 2023 17:18:44 -0700 Subject: [PATCH] fix int parsing --- src/main.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 7826eb4..352f8b2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -108,7 +108,7 @@ fn get_allowed_map() -> Result, Box::new(); for entry in std::fs::read_dir("scripts/allowed")? { let entry=entry?; - allowed_map.insert(entry.file_name().to_str().unwrap().parse::()?,std::fs::read_to_string(entry.path())?); + allowed_map.insert(entry.path().file_stem().unwrap().to_str().unwrap().parse::()?,std::fs::read_to_string(entry.path())?); } Ok(allowed_map) } @@ -117,7 +117,7 @@ fn get_replace_map() -> Result, Box::new(); for entry in std::fs::read_dir("scripts/replace")? { let entry=entry?; - replace.insert(std::fs::read_to_string(entry.path())?,entry.file_name().to_str().unwrap().parse::()?); + replace.insert(std::fs::read_to_string(entry.path())?,entry.path().file_stem().unwrap().to_str().unwrap().parse::()?); } Ok(replace) }