Skip to content

Commit

Permalink
Auto merge of #43614 - pornel:is_gotcha, r=BurntSushi
Browse files Browse the repository at this point in the history
Emphasise that these functions look at the disk, not just the path

I thought that `PathBuf::new("foo/bar/").is_dir()` is always true, because the path ends in `/`. However, this is not what `is_dir()` function does. So I've updated the docs to make it clear.
  • Loading branch information
bors committed Aug 2, 2017
2 parents 4596c71 + 4792d28 commit b75d1f0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/libstd/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2237,7 +2237,7 @@ impl Path {
fs::metadata(self).is_ok()
}

/// Returns whether the path is pointing at a regular file.
/// Returns whether the path exists on disk and is pointing at a regular file.
///
/// This function will traverse symbolic links to query information about the
/// destination file. In case of broken symbolic links this will return `false`.
Expand Down Expand Up @@ -2266,7 +2266,7 @@ impl Path {
fs::metadata(self).map(|m| m.is_file()).unwrap_or(false)
}

/// Returns whether the path is pointing at a directory.
/// Returns whether the path exists on disk and is pointing at a directory.
///
/// This function will traverse symbolic links to query information about the
/// destination file. In case of broken symbolic links this will return `false`.
Expand Down

0 comments on commit b75d1f0

Please sign in to comment.