use std::path::Path;
pub fn link_icon() -> char {
'\u{f0c1}' }
pub fn dir_icon(expanded: bool) -> char {
if expanded {
'\u{f07c}' } else {
'\u{f07b}' }
}
pub fn file_icon(path: &Path) -> char {
let name = path.file_name().and_then(|n| n.to_str()).unwrap_or("");
match name.to_ascii_lowercase().as_str() {
".gitignore" | ".gitattributes" | ".gitmodules" => return '\u{e702}', "license" | "license.md" | "license.txt" | "copying" => return '\u{f0f6}', _ => {}
}
let ext = path
.extension()
.and_then(|e| e.to_str())
.unwrap_or("")
.to_ascii_lowercase();
match ext.as_str() {
"rs" => '\u{e7a8}', "md" | "markdown" | "mmd" | "mermaid" => '\u{e73e}', "toml" | "yaml" | "yml" | "ini" | "cfg" | "conf" => '\u{e615}', "json" => '\u{e60b}', "js" | "mjs" | "cjs" => '\u{e74e}', "ts" | "tsx" => '\u{e628}', "py" => '\u{e73c}', "go" => '\u{e627}', "c" | "h" => '\u{e61e}', "cpp" | "cc" | "cxx" | "hpp" => '\u{e61d}', "sh" | "bash" | "zsh" | "fish" => '\u{f489}', "png" | "jpg" | "jpeg" | "gif" | "webp" | "bmp" | "ico" | "svg" => '\u{f1c5}', "mp4" | "mov" | "mkv" | "webm" | "avi" => '\u{f03d}', "lock" => '\u{f023}', "txt" | "log" => '\u{f15c}', _ => '\u{f016}', }
}