diff options
author | Sebastian Thiel <sebastian.thiel@icloud.com> | 2020-03-29 10:55:32 +0800 |
---|---|---|
committer | Sebastian Thiel <sebastian.thiel@icloud.com> | 2020-03-29 10:55:32 +0800 |
commit | 9824585960f09729c5547d60edaea5d97fdb595f (patch) | |
tree | 5c57e738d06cc9fc35d7479fe1ba3e576c918f83 | |
parent | 6b90258662810ce740f7f9ad44234e10f3367fc3 (diff) |
cleanup 'quick-hack' done in 2.3.9 - much better now
-rw-r--r-- | README.md | 3 | ||||
-rw-r--r-- | src/aggregate.rs | 9 | ||||
-rw-r--r-- | src/main.rs | 8 | ||||
-rw-r--r-- | src/traverse.rs | 9 |
4 files changed, 11 insertions, 18 deletions
@@ -96,6 +96,9 @@ Thanks to [jwalk][jwalk], all there was left to do is to write a command-line in ### Limitations +* Does not show symbolic links at all if no path is provided when invoking `dua` + * in an effort to skip symbolic links, for now there are pruned and are not used as a root. Symbolic links will be shown if they + are not a traversal root, but will not be followed. * Interactive mode only looks good in dark terminals (see [this issue](https://github.com/Byron/dua-cli/issues/13)) * _easy fix_: file names in main window are not truncated if too large. They are cut off on the right. * There are plenty of examples in `tests/fixtures` which don't render correctly in interactive mode. diff --git a/src/aggregate.rs b/src/aggregate.rs index 538950a..b04fa83 100644 --- a/src/aggregate.rs +++ b/src/aggregate.rs @@ -23,16 +23,7 @@ pub fn aggregate( let mut aggregates = Vec::new(); let mut inodes = InodeFilter::default(); let paths: Vec<_> = paths.into_iter().collect(); - let input_len = paths.len(); for path in paths.into_iter() { - // For now, bluntly ignore symlinks that are on the top-level, and there are more roots to follow - if input_len > 1 { - if let Ok(meta) = path.as_ref().symlink_metadata() { - if meta.file_type().is_symlink() { - continue; - } - } - } num_roots += 1; let mut num_bytes = 0u64; let mut num_errors = 0u64; diff --git a/src/main.rs b/src/main.rs index cfe6228..91cb79b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -102,6 +102,14 @@ fn cwd_dirlist() -> Result<Vec<PathBuf>, io::Error> { e.ok() .and_then(|e| e.path().strip_prefix(".").ok().map(ToOwned::to_owned)) }) + .filter(|p| { + if let Ok(meta) = p.symlink_metadata() { + if meta.file_type().is_symlink() { + return false; + } + }; + true + }) .collect(); v.sort(); Ok(v) diff --git a/src/traverse.rs b/src/traverse.rs index c971bd1..ab4eff9 100644 --- a/src/traverse.rs +++ b/src/traverse.rs @@ -78,16 +78,7 @@ impl Traversal { // Also means that we will spin up a bunch of threads per root path, instead of reusing them. walk_options.threads = num_cpus::get(); } - let input_len = input.len(); for path in input.into_iter() { - // For now, bluntly ignore symlinks that are on the top-level, and there are more roots to follow - if input_len > 1 { - if let Ok(meta) = path.symlink_metadata() { - if meta.file_type().is_symlink() { - continue; - } - } - } let mut last_seen_eid = 0; for (eid, entry) in walk_options .iter_from_path(path.as_ref()) |