File tree 2 files changed +21
-0
lines changed
2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -445,6 +445,24 @@ impl MetadataExt for Metadata {
445
445
fn file_size ( & self ) -> u64 { self . as_inner ( ) . size ( ) }
446
446
}
447
447
448
+ /// Add support for the Windows specific fact that a symbolic link knows whether it is a file
449
+ /// or directory.
450
+ #[ unstable( feature = "windows_file_type_ext" , issue = "0" ) ]
451
+ pub trait FileTypeExt {
452
+ /// Returns whether this file type is a symbolic link that is also a directory.
453
+ #[ unstable( feature = "windows_file_type_ext" , issue = "0" ) ]
454
+ fn is_symlink_dir ( & self ) -> bool ;
455
+ /// Returns whether this file type is a symbolic link that is also a file.
456
+ #[ unstable( feature = "windows_file_type_ext" , issue = "0" ) ]
457
+ fn is_symlink_file ( & self ) -> bool ;
458
+ }
459
+
460
+ #[ unstable( feature = "windows_file_type_ext" , issue = "0" ) ]
461
+ impl FileTypeExt for fs:: FileType {
462
+ fn is_symlink_dir ( & self ) -> bool { self . as_inner ( ) . is_symlink_dir ( ) }
463
+ fn is_symlink_file ( & self ) -> bool { self . as_inner ( ) . is_symlink_file ( ) }
464
+ }
465
+
448
466
/// Creates a new file symbolic link on the filesystem.
449
467
///
450
468
/// The `dst` path will be a file symbolic link pointing to the `src`
Original file line number Diff line number Diff line change @@ -534,6 +534,9 @@ impl FileType {
534
534
pub fn is_symlink_dir ( & self ) -> bool {
535
535
self . is_symlink ( ) && self . is_directory ( )
536
536
}
537
+ pub fn is_symlink_file ( & self ) -> bool {
538
+ self . is_symlink ( ) && !self . is_directory ( )
539
+ }
537
540
fn is_directory ( & self ) -> bool {
538
541
self . attributes & c:: FILE_ATTRIBUTE_DIRECTORY != 0
539
542
}
You can’t perform that action at this time.
0 commit comments