Skip to content

Commit

Permalink
Stabilize Windows FileTypeExt with is_symlink_dir and `is_symlink…
Browse files Browse the repository at this point in the history
…_file`

These calls allow detecting whether a symlink is a file or a directory,
a distinction Windows maintains, and one important to software that
wants to do further operations on the symlink (e.g. removing it).
  • Loading branch information
joshtriplett committed Jun 27, 2022
1 parent bd2e51a commit e374c91
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions library/std/src/os/windows/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -502,17 +502,17 @@ impl MetadataExt for Metadata {
/// Windows-specific extensions to [`fs::FileType`].
///
/// On Windows, a symbolic link knows whether it is a file or directory.
#[unstable(feature = "windows_file_type_ext", issue = "none")]
#[stable(feature = "windows_file_type_ext", since = "1.64.0")]
pub trait FileTypeExt {
/// Returns `true` if this file type is a symbolic link that is also a directory.
#[unstable(feature = "windows_file_type_ext", issue = "none")]
#[stable(feature = "windows_file_type_ext", since = "1.64.0")]
fn is_symlink_dir(&self) -> bool;
/// Returns `true` if this file type is a symbolic link that is also a file.
#[unstable(feature = "windows_file_type_ext", issue = "none")]
#[stable(feature = "windows_file_type_ext", since = "1.64.0")]
fn is_symlink_file(&self) -> bool;
}

#[unstable(feature = "windows_file_type_ext", issue = "none")]
#[stable(feature = "windows_file_type_ext", since = "1.64.0")]
impl FileTypeExt for fs::FileType {
fn is_symlink_dir(&self) -> bool {
self.as_inner().is_symlink_dir()
Expand Down

0 comments on commit e374c91

Please # to comment.