diff options
author | Ben Morrison <ben@gbmor.dev> | 2019-09-07 16:48:07 -0400 |
---|---|---|
committer | Ben Morrison <ben@gbmor.dev> | 2019-09-07 16:48:07 -0400 |
commit | 298966ef2c51a9c9722f9e29e9173b47972a096c (patch) | |
tree | 329247a05cc8a2c1a80db417ed317496d4fcca89 /src | |
parent | a772e82911aa1a95d763ed682aa0ee7d648dcb2a (diff) | |
download | instistats-298966ef2c51a9c9722f9e29e9173b47972a096c.tar.gz |
fixed user counts
Diffstat (limited to 'src')
-rw-r--r-- | src/main.rs | 7 |
1 files changed, 6 insertions, 1 deletions
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::<Vec<fs::DirEntry>>() + .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(); |