File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,8 @@ impl Iterator for Iter {
25
25
let mut iterator = match self . actively_walking . take ( ) {
26
26
Some ( dir) => dir,
27
27
None => {
28
- while let Some ( path) = self . directories_to_walk . pop ( ) {
28
+ while !self . directories_to_walk . is_empty ( ) {
29
+ let path = self . directories_to_walk . remove ( 0 ) ;
29
30
match fs:: read_dir ( & path) {
30
31
Ok ( directory) => {
31
32
self . actively_walking = Some ( directory) ;
@@ -47,7 +48,7 @@ impl Iterator for Iter {
47
48
48
49
if let Ok ( file_type) = entry. file_type ( ) {
49
50
if file_type. is_dir ( ) {
50
- self . directories_to_walk . push ( path) ;
51
+ self . directories_to_walk . insert ( 0 , path) ;
51
52
} else if ( file_type. is_file ( ) || file_type. is_symlink ( ) )
52
53
&& path. extension ( ) . map_or ( false , |ext| ext == "desktop" )
53
54
{
Original file line number Diff line number Diff line change @@ -288,7 +288,6 @@ pub enum PathSource {
288
288
}
289
289
290
290
impl PathSource {
291
-
292
291
/// Attempts to determine the PathSource for a given Path.
293
292
/// Note that this is a best-effort guesting function, and its results should be treated as
294
293
/// such (e.g.: non-canonical).
@@ -304,15 +303,19 @@ impl PathSource {
304
303
PathSource :: SystemFlatpak
305
304
} else if path. starts_with ( "/var/lib/snapd" ) {
306
305
PathSource :: SystemSnap
307
- } else if path. starts_with ( "/nix/var/nix/profiles/default" ) || path. starts_with ( "/nix/store" ) {
306
+ } else if path. starts_with ( "/nix/var/nix/profiles/default" )
307
+ || path. starts_with ( "/nix/store" )
308
+ {
308
309
PathSource :: Nix
309
310
} else if path. to_string_lossy ( ) . contains ( "/flatpak/" ) {
310
311
PathSource :: LocalFlatpak
311
312
} else if path. starts_with ( & data_home. as_path ( ) ) {
312
313
PathSource :: Local
313
- } else if path. starts_with ( "/nix/var/nix/profiles/per-user" ) || path. to_string_lossy ( ) . contains ( ".nix" ) {
314
+ } else if path. starts_with ( "/nix/var/nix/profiles/per-user" )
315
+ || path. to_string_lossy ( ) . contains ( ".nix" )
316
+ {
314
317
PathSource :: LocalNix
315
- } else {
318
+ } else {
316
319
PathSource :: Other ( String :: from ( "unknown" ) )
317
320
}
318
321
}
You can’t perform that action at this time.
0 commit comments