Always follow symlinks on explicit file arguments.

This commit is contained in:
Ian Kerins
2016-10-08 22:40:03 -04:00
parent 4ee6dbe422
commit 1c964372ad
2 changed files with 22 additions and 1 deletions

View File

@@ -708,7 +708,9 @@ impl Args {
/// Create a new recursive directory iterator at the path given.
pub fn walker(&self, path: &Path) -> Result<walk::Iter> {
let mut wd = WalkDir::new(path).follow_links(self.follow);
// Always follow symlinks for explicitly specified files.
let mut wd = WalkDir::new(path).follow_links(self.follow
|| path.is_file());
if let Some(maxdepth) = self.maxdepth {
wd = wd.max_depth(maxdepth);
}