@@ -740,6 +740,12 @@ extension FileManager {
740
740
}
741
741
742
742
internal func _lstatFile( atPath path: String , withFileSystemRepresentation fsRep: UnsafePointer < NativeFSRCharType > ? = nil ) throws -> stat {
743
+ let ( stbuf, _) = try _statxFile ( atPath: path, withFileSystemRepresentation: fsRep)
744
+ return stbuf
745
+ }
746
+
747
+ // FIXME(compnerd) the UInt64 should be UInt128 to uniquely identify the file across volumes
748
+ internal func _statxFile( atPath path: String , withFileSystemRepresentation fsRep: UnsafePointer < NativeFSRCharType > ? = nil ) throws -> ( stat , UInt64 ) {
743
749
let _fsRep : UnsafePointer < NativeFSRCharType >
744
750
if fsRep == nil {
745
751
_fsRep = try __fileSystemRepresentation ( withPath: path)
@@ -771,7 +777,8 @@ extension FileManager {
771
777
statInfo. st_atime = info. ftLastAccessTime. time_t
772
778
statInfo. st_ctime = info. ftCreationTime. time_t
773
779
statInfo. st_dev = info. dwVolumeSerialNumber
774
- // inodes have meaning on FAT/HPFS/NTFS
780
+ // The inode, and therefore st_ino, has no meaning in the FAT, HPFS, or
781
+ // NTFS file systems. -- docs.microsoft.com
775
782
statInfo. st_ino = 0
776
783
statInfo. st_rdev = info. dwVolumeSerialNumber
777
784
@@ -795,7 +802,8 @@ extension FileManager {
795
802
statInfo. st_size = Int32 ( info. nFileSizeLow)
796
803
// Uid is always 0 on Windows systems
797
804
statInfo. st_uid = 0
798
- return statInfo
805
+
806
+ return ( statInfo, UInt64 ( info. nFileIndexHigh << 32 ) | UInt64 ( info. nFileIndexLow) )
799
807
}
800
808
801
809
internal func _contentsEqual( atPath path1: String , andPath path2: String ) -> Bool {
0 commit comments