From 298966ef2c51a9c9722f9e29e9173b47972a096c Mon Sep 17 00:00:00 2001 From: Ben Morrison Date: Sat, 7 Sep 2019 16:48:07 -0400 Subject: fixed user counts --- src/main.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 605db66..a2c9c9b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -49,6 +49,11 @@ fn main() { println!(); let home_dir = WalkDir::new("/home").follow_links(true).max_depth(1); + let user_count = fs::read_dir("/home") + .unwrap() + .map(|d| d.unwrap()) + .collect::>() + .len(); let mut users_list = Vec::new(); home_dir.into_iter().for_each(|d| { if let Ok(p) = d { @@ -142,7 +147,7 @@ fn main() { conf_yaml.users.push(user.clone()); }); - conf_yaml.user_count = users_struct.len(); + conf_yaml.user_count = user_count; let json = serde_json::to_string(&conf_yaml).unwrap(); fs::write(out_path, &json).unwrap(); -- cgit 1.4.1-2-gfad0