Skip to content

Commit edba471

Browse files
committed
add an API to check existence of directory entry.
1 parent 69e1754 commit edba471

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

src/filesystem/directory.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,15 @@ where
153153
.find_directory_entry(self.raw_directory, name)
154154
}
155155

156+
/// Check whether a directory entry exists.
157+
pub fn directory_entry_exists<N: ToShortFileName>(&self, name: N) -> bool {
158+
let find_result = self.find_directory_entry(name);
159+
if find_result.is_ok() {
160+
return true;
161+
}
162+
false
163+
}
164+
156165
/// Call a callback function for each directory entry in a directory.
157166
///
158167
/// Long File Names will be ignored.

0 commit comments

Comments
 (0)