Improve the icons detection

This commit is contained in:
Peltoche 2018-11-24 19:44:42 +01:00
parent 6bab5a75b6
commit b71204e158
No known key found for this signature in database
GPG key ID: CED68D0487156952

View file

@ -19,13 +19,17 @@ impl Formatter {
let mut content = String::new();
let color = if meta.metadata.is_dir() {
content = content + Logo::folder().as_str() + " " + &meta.name;
Colors[&Elem::Dir]
} else {
content = content + Logo::from_pathbuf(&meta.path).as_str() + " " + &meta.name;
Colors[&Elem::UnrecognizedFile]
};
let mut name = meta.name.clone();
if meta.metadata.is_dir() {
name.push('/');
}
content = content + Logo::from_meta(&meta).as_str() + " " + &name;
content = color.paint(content).to_string();
content