diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2016-06-02 13:47:08 +0200 |
|---|---|---|
| committer | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2016-06-02 13:47:08 +0200 |
| commit | 083e013086131ccc124cc881610c8444040c56bf (patch) | |
| tree | ae9c6013f6cf6c360325238f9d79bb851b87b67d /src/libstd | |
| parent | 320e27dc80ad1ced41b5a69fa6114ef70aa3340d (diff) | |
| parent | 1d7f34538d9dd08958671f6606e51a32e237e174 (diff) | |
| download | rust-083e013086131ccc124cc881610c8444040c56bf.tar.gz rust-083e013086131ccc124cc881610c8444040c56bf.zip | |
Rollup merge of #34019 - kennytm:fix-33958, r=steveklabnik
Restore original meaning of std::fs::read_dir's example changed in #33958 `DirEntry.file_type().is_dir()` will not follow symlinks, but the original example (`fs::metadata(&path).is_dir()`) does. Therefore the change in #33958 introduced a subtle difference that now it won't enter linked folders. To preserve the same behavior, we use `Path::is_dir()` instead, which does follow symlink. (See discussion in the previous PR for detail.)
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/fs.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/libstd/fs.rs b/src/libstd/fs.rs index 60c2a516d6a..0180c3118a5 100644 --- a/src/libstd/fs.rs +++ b/src/libstd/fs.rs @@ -1343,8 +1343,9 @@ pub fn remove_dir_all<P: AsRef<Path>>(path: P) -> io::Result<()> { /// if dir.is_dir() { /// for entry in try!(fs::read_dir(dir)) { /// let entry = try!(entry); -/// if try!(entry.file_type()).is_dir() { -/// try!(visit_dirs(&entry.path(), cb)); +/// let path = entry.path(); +/// if path.is_dir() { +/// try!(visit_dirs(&path, cb)); /// } else { /// cb(&entry); /// } |
