diff options
author | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:16:21 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:16:21 +0200 |
commit | 88a2d0007db222c339f0b6a17794a2014a241892 (patch) | |
tree | 75105ef49b3a52b7ee176a1ad480e7652e49825f /zen/file_id.cpp | |
parent | 4.2 (diff) | |
download | FreeFileSync-88a2d0007db222c339f0b6a17794a2014a241892.tar.gz FreeFileSync-88a2d0007db222c339f0b6a17794a2014a241892.tar.bz2 FreeFileSync-88a2d0007db222c339f0b6a17794a2014a241892.zip |
4.3
Diffstat (limited to 'zen/file_id.cpp')
-rw-r--r-- | zen/file_id.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/zen/file_id.cpp b/zen/file_id.cpp index acbdcd7b..7527062b 100644 --- a/zen/file_id.cpp +++ b/zen/file_id.cpp @@ -5,7 +5,6 @@ // ************************************************************************** #include "file_id.h" -#include "file_id_internal.h" #ifdef FFS_WIN #include "win.h" //includes "windows.h" @@ -17,7 +16,7 @@ #endif -std::string zen::getFileID(const Zstring& filename) +zen::FileId zen::getFileID(const Zstring& filename) { #ifdef FFS_WIN //WARNING: CreateFile() is SLOW, while GetFileInformationByHandle() is cheap! @@ -43,11 +42,11 @@ std::string zen::getFileID(const Zstring& filename) #elif defined FFS_LINUX struct ::stat fileInfo = {}; - if (::lstat(filename.c_str(), &fileInfo) == 0) //lstat() does not follow symlinks + if (::stat(filename.c_str(), &fileInfo) == 0) //stat() follows symlinks return extractFileID(fileInfo); #endif - return std::string(); + return zen::FileId(); } @@ -56,10 +55,10 @@ bool zen::samePhysicalFile(const Zstring& file1, const Zstring& file2) if (EqualFilename()(file1, file2)) //quick check return true; - const std::string id1 = getFileID(file1); - const std::string id2 = getFileID(file2); + const auto id1 = getFileID(file1); + const auto id2 = getFileID(file2); - if (id1.empty() || id2.empty()) + if (id1 == zen::FileId() || id2 == zen::FileId()) return false; return id1 == id2; |