DirEntry: add methods to check if is a file or a dir
This commit is contained in:
parent
1bfd7d3ba5
commit
56871201dd
1 changed files with 10 additions and 0 deletions
10
src/dir.rs
10
src/dir.rs
|
|
@ -157,6 +157,16 @@ impl RegularDirEntry {
|
|||
self.name[0] == 0x00
|
||||
}
|
||||
|
||||
pub fn is_file(&self) -> bool {
|
||||
!self
|
||||
.attr
|
||||
.intersects(Attr::Directory | Attr::System | Attr::VolumeId)
|
||||
}
|
||||
|
||||
pub fn is_dir(&self) -> bool {
|
||||
self.attr.contains(Attr::Directory) && !self.attr.intersects(Attr::System | Attr::VolumeId)
|
||||
}
|
||||
|
||||
pub fn name(&self) -> &[u8] {
|
||||
&self.name
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue