diff options
author | Ben S <ogham@bsago.me> | 2015-08-26 09:35:11 +0100 |
---|---|---|
committer | Ben S <ogham@bsago.me> | 2015-08-26 09:35:11 +0100 |
commit | b5edee53bd829188d0b60fe73308a7a28561210f (patch) | |
tree | 1b48af2899027427fd723b3e8ef86ceed383813c /src/output | |
parent | 69b22a0d669f6cb741290b96fe717e30efb70216 (diff) |
Scan for nested files on-demand, not all the time
This does a similar thing that we did with the xattrs, except with the nested files: it removes the 'this' field on File, and replaces it with a method (to_dir) that has the same effect.
This means we get to remove a bunch of 'recurse' fields and parameters that really had no business being there! Now the table doesn't need to know whether it's going to need to list files recursively or not.
Diffstat (limited to 'src/output')
-rw-r--r-- | src/output/details.rs | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/output/details.rs b/src/output/details.rs index 72dc1ba..826a2ea 100644 --- a/src/output/details.rs +++ b/src/output/details.rs @@ -104,18 +104,18 @@ impl Details { // dealt with in the main module. So only actually recurse if we // are in tree mode - the other case will be dealt with elsewhere. if let Some((r, filter)) = self.recurse { - if r.tree == false || r.is_too_deep(depth) { + if !file.is_directory() || !r.tree || r.is_too_deep(depth) { continue; } // Use the filter to remove unwanted files *before* expanding // them, so we don't examine any directories that wouldn't // have their contents listed anyway. - match file.this { - Some(Ok(ref dir)) => { + match file.to_dir() { + Ok(ref dir) => { let mut files = Vec::new(); - let files_to_add = dir.files(true).collect::<Vec<_>>(); + let files_to_add = dir.files().collect::<Vec<_>>(); let child_count = files_to_add.len(); for (index, file_to_add) in files_to_add.into_iter().enumerate() { match file_to_add { @@ -127,10 +127,9 @@ impl Details { filter.transform_files(&mut files); self.add_files_to_table(table, &files, depth + 1); }, - Some(Err(ref e)) => { + Err(ref e) => { table.add_error(e, depth + 1, true, None); }, - None => {}, } } } |