You can use the Boost Filesystem .
He has the extra weight of cross-platform; this is obviously also a potential advantage. Check out the biased API link below if you want to check it out: GetFileInformationByHandle.
bool equivalent(const path& p1, const path& p2); bool equivalent(const path& p1, const path& p2, system::error_code& ec);
Effects : Defines the file_files s1 and s2, as if by status (p1) and status (p2), respectively.
Returns : true if sf1 == sf2 and p1 and p2 are allowed for the same file system object, otherwise false.
Two paths are considered allowed for the same file system object if two candidate objects are on the same device in the same place. This is defined as if the values ββof the POSIX stat structure were obtained as by stat () for two paths having equal st_dev values ββand equal st_ino values.
[ Note : POSIX requires "st_dev to be unique on the local network." Conservative POSIX implementations can also check for equal st_size and st_mtime values. Windows implementations can use GetFileInformationByHandle () as a surrogate for stat () and assume that the "same" are equal for dwVolumeSerialNumber, nFileIndexHigh, nFileIndexLow, nFileSizeHigh, nFileSizeLow, ftLastWriteTime.dwLowDateTimeTimeTimeTime.imewimeTimeTimeTime.imewtimeTimeTimeTime.imewtimeTimeTimeTime.imewtowTimeTimeTime.imewtowTimeTimeTime.dwLowDateTimeTimeTimeTime.imewimeTimeTime.ime
Throws : filesystem_error if (! Exists (s1) & &! Exists (s2)) || (is_other (s1) & is_other (s2)), otherwise, as indicated in the error report.
source share