diff options
| author | Peter Atashian <retep998@gmail.com> | 2018-02-11 13:40:46 -0500 |
|---|---|---|
| committer | Peter Atashian <retep998@gmail.com> | 2018-02-11 13:40:46 -0500 |
| commit | 9269e83b37e8e5fd9cef12255fafbc6db6220035 (patch) | |
| tree | f71548d43ef52d8f165b281ca31060733c6bd787 /src/libstd/sys/windows/ext | |
| parent | c42d76d3c80b4938e26e628706363b677fde6ca1 (diff) | |
| download | rust-9269e83b37e8e5fd9cef12255fafbc6db6220035.tar.gz rust-9269e83b37e8e5fd9cef12255fafbc6db6220035.zip | |
Add an unstable FileTypeExt extension trait for Windows
Diffstat (limited to 'src/libstd/sys/windows/ext')
| -rw-r--r-- | src/libstd/sys/windows/ext/fs.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/libstd/sys/windows/ext/fs.rs b/src/libstd/sys/windows/ext/fs.rs index 24c41046f26..38bf4cca851 100644 --- a/src/libstd/sys/windows/ext/fs.rs +++ b/src/libstd/sys/windows/ext/fs.rs @@ -445,6 +445,24 @@ impl MetadataExt for Metadata { fn file_size(&self) -> u64 { self.as_inner().size() } } +/// Add support for the Windows specific fact that a symbolic link knows whether it is a file +/// or directory. +#[unstable(feature = "windows_file_type_ext", issue = "0")] +pub trait FileTypeExt { + /// Returns whether this file type is a symbolic link that is also a directory. + #[unstable(feature = "windows_file_type_ext", issue = "0")] + fn is_symlink_dir(&self) -> bool; + /// Returns whether this file type is a symbolic link that is also a file. + #[unstable(feature = "windows_file_type_ext", issue = "0")] + fn is_symlink_file(&self) -> bool; +} + +#[unstable(feature = "windows_file_type_ext", issue = "0")] +impl FileTypeExt for fs::FileType { + fn is_symlink_dir(&self) -> bool { self.as_inner().is_symlink_dir() } + fn is_symlink_file(&self) -> bool { self.as_inner().is_symlink_file() } +} + /// Creates a new file symbolic link on the filesystem. /// /// The `dst` path will be a file symbolic link pointing to the `src` |
