summaryrefslogtreecommitdiffstats
path: root/Source/kwsys/SystemTools.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-01-22 10:58:45 (GMT)
committerBrad King <brad.king@kitware.com>2022-01-22 10:58:45 (GMT)
commitecd5a18928716ce9452e0e4d5ab62a4f3182b77c (patch)
tree42b2067149c9753fb24ab6b635d23b4ba3fa56fa /Source/kwsys/SystemTools.cxx
parent850bdc4203f4599fceaed2ae9ba21c53e71fd0fb (diff)
parentca03a9be6c629bec1ff989057bc3974d74b2904a (diff)
downloadCMake-ecd5a18928716ce9452e0e4d5ab62a4f3182b77c.zip
CMake-ecd5a18928716ce9452e0e4d5ab62a4f3182b77c.tar.gz
CMake-ecd5a18928716ce9452e0e4d5ab62a4f3182b77c.tar.bz2
Merge branch 'upstream-KWSys' into update-kwsys
# By KWSys Upstream * upstream-KWSys: KWSys 2022-01-22 (16e180ad)
Diffstat (limited to 'Source/kwsys/SystemTools.cxx')
-rw-r--r--Source/kwsys/SystemTools.cxx21
1 files changed, 14 insertions, 7 deletions
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx
index c339fd5..c38b456 100644
--- a/Source/kwsys/SystemTools.cxx
+++ b/Source/kwsys/SystemTools.cxx
@@ -2287,7 +2287,7 @@ bool SystemTools::FilesDiffer(const std::string& source,
if (statSource.nFileSizeHigh == 0 && statSource.nFileSizeLow == 0) {
return false;
}
- off_t nleft =
+ auto nleft =
((__int64)statSource.nFileSizeHigh << 32) + statSource.nFileSizeLow;
#else
@@ -3085,11 +3085,10 @@ bool SystemTools::FileIsExecutable(const std::string& name)
return !FileIsDirectory(name) && TestFileAccess(name, TEST_FILE_EXECUTE);
}
-bool SystemTools::FileIsSymlink(const std::string& name)
-{
#if defined(_WIN32)
- std::wstring path = Encoding::ToWindowsExtendedPath(name);
- DWORD attr = GetFileAttributesW(path.c_str());
+bool SystemTools::FileIsSymlinkWithAttr(const std::wstring& path,
+ unsigned long attr)
+{
if (attr != INVALID_FILE_ATTRIBUTES) {
if ((attr & FILE_ATTRIBUTE_REPARSE_POINT) != 0) {
// FILE_ATTRIBUTE_REPARSE_POINT means:
@@ -3118,9 +3117,17 @@ bool SystemTools::FileIsSymlink(const std::string& name)
(reparseTag == IO_REPARSE_TAG_MOUNT_POINT);
}
return false;
- } else {
- return false;
}
+
+ return false;
+}
+#endif
+
+bool SystemTools::FileIsSymlink(const std::string& name)
+{
+#if defined(_WIN32)
+ std::wstring path = Encoding::ToWindowsExtendedPath(name);
+ return FileIsSymlinkWithAttr(path, GetFileAttributesW(path.c_str()));
#else
struct stat fs;
if (lstat(name.c_str(), &fs) == 0) {