File tree Expand file tree Collapse file tree 3 files changed +9
-6
lines changed Expand file tree Collapse file tree 3 files changed +9
-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`].
@@ -13,7 +17,9 @@ use alloc::boxed::Box;
13
17
pub struct UefiDirectoryIter ( UefiDirectoryHandle ) ;
14
18
15
19
impl UefiDirectoryIter {
20
+
16
21
/// Constructor.
22
+ #[ must_use]
17
23
pub fn new ( handle : UefiDirectoryHandle ) -> Self {
18
24
Self ( handle)
19
25
}
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 > ;
@@ -188,13 +186,12 @@ impl<'a> FileSystem<'a> {
188
186
/// Removes a directory at this path, after removing all its contents. Use
189
187
/// carefully!
190
188
pub fn remove_dir_all ( & mut self , path : impl AsRef < Path > ) -> FileSystemResult < ( ) > {
191
- const SKIP_DIRS : [ & CStr16 ; 2 ] = [ cstr16 ! ( "." ) , cstr16 ! ( ".." ) ] ;
192
189
let path = path. as_ref ( ) ;
193
190
for file_info in self
194
191
. read_dir ( path) ?
195
192
. filter_map ( |file_info_result| file_info_result. ok ( ) )
196
193
{
197
- if SKIP_DIRS . contains ( & file_info. file_name ( ) ) {
194
+ if COMMON_SKIP_DIRS . contains ( & file_info. file_name ( ) ) {
198
195
continue ;
199
196
}
200
197
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