(path: &str)
| 30 | } |
| 31 | |
| 32 | pub fn kind_label(path: &str) -> &'static str { |
| 33 | if path.ends_with('/') { |
| 34 | return "folder"; |
| 35 | } |
| 36 | let Some(ext) = Path::new(path).extension().and_then(|v| v.to_str()) else { |
| 37 | return "other"; |
| 38 | }; |
| 39 | match ext.to_ascii_lowercase().as_str() { |
| 40 | "scn" | "fur" => "scene", |
| 41 | "rs" => "script", |
| 42 | "png" | "jpg" | "jpeg" | "webp" | "bmp" | "tga" => "image", |
| 43 | "wav" | "ogg" | "mp3" | "flac" | "aac" | "m4a" | "mid" | "midi" | "sf2" => "audio", |
| 44 | "pmat" | "uistyle" | "ppart" | "ptileset" | "panim" | "panimtree" | "pskel2d" |
| 45 | | "pskel3d" => "resource", |
| 46 | "glb" | "gltf" | "obj" | "fbx" => "mesh", |
| 47 | _ => "other", |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | pub fn display_kind_label(path: &str) -> &'static str { |
| 52 | if path.ends_with('/') { |
no test coverage detected