1use std::fs;
2
3use crate::configs::dirs_and_files;
4
5pub fn get_profiles_list() -> Vec<String> {
6 let profile_path = dirs_and_files::get_profiles_folder_path();
7
8 let itens = fs::read_dir(profile_path);
9
10 if let Ok(itens) = itens {
11 let mut itens = itens
12 .map(|profile| {
13 if let Ok(profile) = profile {
14 profile.file_name().to_str().unwrap().to_string()
15 } else {
16 "Without permission".to_owned()
17 }
18 })
19 .collect::<Vec<_>>();
20 itens.sort();
21
22 itens
23 } else {
24 vec![]
25 }
26}