cargo_plot/theme/for_path_list.rs
1/// [POL]: Przypisuje ikonę (emoji) do ścieżki na podstawie atrybutów: katalog oraz status elementu ukrytego.
2/// [ENG]: Assigns an icon (emoji) to a path based on attributes: directory status and hidden element status.
3pub fn get_icon_for_path(path: &str) -> &'static str {
4 let is_dir = path.ends_with('/');
5
6 let nazwa = path
7 .trim_end_matches('/')
8 .split('/')
9 .next_back()
10 .unwrap_or("");
11 let is_hidden = nazwa.starts_with('.');
12
13 match (is_dir, is_hidden) {
14 (true, false) => "📁", // [POL]: Folder | [ENG]: Directory
15 (true, true) => "🗃️", // [POL]: Ukryty folder | [ENG]: Hidden directory
16 (false, false) => "📄", // [POL]: Plik | [ENG]: File
17 (false, true) => "⚙️ ", // [POL]: Ukryty plik | [ENG]: Hidden file
18 }
19}