Selected icons for special Unix file types

This commit is contained in:
Seth Junot 2019-08-09 11:37:56 -07:00 committed by Abin Simon
parent 038d2c1537
commit 58a503505d
2 changed files with 30 additions and 4 deletions

View file

@ -58,11 +58,37 @@ impl Icons {
let mut res = String::with_capacity(4 + ICON_SPACE.len()); // 4 == max icon size
// Check directory.
if let FileType::Directory { .. } = name.file_type() {
// Check file types
let file_type: FileType = name.file_type();
if let FileType::Directory { .. } = file_type {
res += self.default_folder_icon;
res += ICON_SPACE;
return res;
} else if let FileType::SymLink = file_type {
res += "\u{e27c}"; // ""
res += ICON_SPACE;
return res;
} else if let FileType::Socket = file_type {
res += "\u{f6a7}"; // ""
res += ICON_SPACE;
return res;
} else if let FileType::Pipe = file_type {
res += "\u{f731}"; // ""
res += ICON_SPACE;
return res;
} else if let FileType::CharDevice = file_type {
res += "\u{e601}"; // ""
res += ICON_SPACE;
return res;
} else if let FileType::BlockDevice = file_type {
res += "\u{fc29}"; // "ﰩ"
res += ICON_SPACE;
return res;
} else if let FileType::Special = file_type {
res += "\u{f2dc}"; // ""
res += ICON_SPACE;
return res;
}
// Check the known names.

View file

@ -175,7 +175,7 @@ mod test {
let name = Name::new(&symlink_path, file_type);
assert_eq!(
Colour::Fixed(44).paint(" target.tmp"),
Colour::Fixed(44).paint(" target.tmp"),
name.render(&colors, &icons)
);
}
@ -201,7 +201,7 @@ mod test {
let name = Name::new(&pipe_path, file_type);
assert_eq!(
Colour::Fixed(184).paint(" pipe.tmp"),
Colour::Fixed(184).paint(" pipe.tmp"),
name.render(&colors, &icons)
);
}