File tree Expand file tree Collapse file tree 3 files changed +8
-6
lines changed Expand file tree Collapse file tree 3 files changed +8
-6
lines changed Original file line number Diff line number Diff line change 1
1
//! Module for directory iteration. See [`UefiDirectoryIter`].
2
2
3
3
use super :: * ;
4
- use crate :: Result ;
4
+ use crate :: { CStr16 , Result } ;
5
5
use alloc:: boxed:: Box ;
6
+ use uefi_macros:: cstr16;
7
+
8
+ /// Common skip dirs in UEFI/FAT-style file systems.
9
+ pub const COMMON_SKIP_DIRS : & [ & CStr16 ] = & [ cstr16 ! ( "." ) , cstr16 ! ( ".." ) ] ;
6
10
7
11
/// Iterates over the entries of an UEFI directory. It returns boxed values of
8
12
/// type [`UefiFileInfo`].
@@ -14,6 +18,7 @@ pub struct UefiDirectoryIter(UefiDirectoryHandle);
14
18
15
19
impl UefiDirectoryIter {
16
20
/// Constructor.
21
+ #[ must_use]
17
22
pub fn new ( handle : UefiDirectoryHandle ) -> Self {
18
23
Self ( handle)
19
24
}
Original file line number Diff line number Diff line change @@ -11,8 +11,6 @@ use core::fmt;
11
11
use core:: fmt:: { Debug , Formatter } ;
12
12
use core:: ops:: Deref ;
13
13
use log:: debug;
14
- use uefi:: CStr16 ;
15
- use uefi_macros:: cstr16;
16
14
17
15
/// Return type for public [`FileSystem`] operations.
18
16
pub type FileSystemResult < T > = Result < T , Error > ;
@@ -186,13 +184,12 @@ impl<'a> FileSystem<'a> {
186
184
/// Removes a directory at this path, after removing all its contents. Use
187
185
/// carefully!
188
186
pub fn remove_dir_all ( & mut self , path : impl AsRef < Path > ) -> FileSystemResult < ( ) > {
189
- const SKIP_DIRS : [ & CStr16 ; 2 ] = [ cstr16 ! ( "." ) , cstr16 ! ( ".." ) ] ;
190
187
let path = path. as_ref ( ) ;
191
188
for file_info in self
192
189
. read_dir ( path) ?
193
190
. filter_map ( |file_info_result| file_info_result. ok ( ) )
194
191
{
195
- if SKIP_DIRS . contains ( & file_info. file_name ( ) ) {
192
+ if COMMON_SKIP_DIRS . contains ( & file_info. file_name ( ) ) {
196
193
continue ;
197
194
}
198
195
Original file line number Diff line number Diff line change @@ -35,8 +35,8 @@ mod file_system;
35
35
mod path;
36
36
mod uefi_types;
37
37
38
+ pub use dir_entry_iter:: * ;
38
39
pub use file_system:: * ;
39
40
pub use path:: * ;
40
41
41
- use dir_entry_iter:: * ;
42
42
use uefi_types:: * ;
You can’t perform that action at this time.
0 commit comments