summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorscivision <scivision@users.noreply.github.com>2023-09-19 03:11:15 (GMT)
committerscivision <scivision@users.noreply.github.com>2023-09-19 03:11:28 (GMT)
commitd49ea4a4d9d2efaa1321b224931ca0e5fea1cade (patch)
tree9e36f22b84f2be1aadd1af0984d6f2a62ddab2bf
parentf5ff17fcf29170541805e7fc7f4a74252fe39b10 (diff)
downloadCMake-d49ea4a4d9d2efaa1321b224931ca0e5fea1cade.zip
CMake-d49ea4a4d9d2efaa1321b224931ca0e5fea1cade.tar.gz
CMake-d49ea4a4d9d2efaa1321b224931ca0e5fea1cade.tar.bz2
Source: Remove redundant FileIsDirectory checks
-rw-r--r--Source/CTest/cmCTestTestHandler.cxx6
-rw-r--r--Source/cmCTest.cxx3
-rw-r--r--Source/cmInstallCommand.cxx3
-rw-r--r--Source/cmOutputRequiredFilesCommand.cxx6
4 files changed, 6 insertions, 12 deletions
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index e4b9239..eb3b4dd 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -1711,8 +1711,7 @@ std::string cmCTestTestHandler::FindExecutable(
// now look in the paths we specified above
for (unsigned int ai = 0; ai < attempted.size() && fullPath.empty(); ++ai) {
// first check without exe extension
- if (cmSystemTools::FileExists(attempted[ai]) &&
- !cmSystemTools::FileIsDirectory(attempted[ai])) {
+ if (cmSystemTools::FileExists(attempted[ai], true)) {
fullPath = cmSystemTools::CollapseFullPath(attempted[ai]);
resultingConfig = attemptedConfigs[ai];
}
@@ -1721,8 +1720,7 @@ std::string cmCTestTestHandler::FindExecutable(
failed.push_back(attempted[ai]);
tempPath =
cmStrCat(attempted[ai], cmSystemTools::GetExecutableExtension());
- if (cmSystemTools::FileExists(tempPath) &&
- !cmSystemTools::FileIsDirectory(tempPath)) {
+ if (cmSystemTools::FileExists(tempPath, true)) {
fullPath = cmSystemTools::CollapseFullPath(tempPath);
resultingConfig = attemptedConfigs[ai];
} else {
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index 36fd3a8..b7232f3 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -1004,8 +1004,7 @@ int cmCTest::ProcessSteps()
for (kk = 0; kk < d.GetNumberOfFiles(); kk++) {
const char* file = d.GetFile(kk);
std::string fullname = notes_dir + "/" + file;
- if (cmSystemTools::FileExists(fullname) &&
- !cmSystemTools::FileIsDirectory(fullname)) {
+ if (cmSystemTools::FileExists(fullname, true)) {
if (!this->Impl->NotesFiles.empty()) {
this->Impl->NotesFiles += ";";
}
diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx
index 7f5f15b..1b47ec4 100644
--- a/Source/cmInstallCommand.cxx
+++ b/Source/cmInstallCommand.cxx
@@ -1837,8 +1837,7 @@ bool HandleDirectoryMode(std::vector<std::string> const& args,
}
// Make sure the name is a directory.
- if (cmSystemTools::FileExists(dir) &&
- !cmSystemTools::FileIsDirectory(dir)) {
+ if (cmSystemTools::FileExists(dir, true)) {
status.SetError(cmStrCat(args[0], " given non-directory \"", args[i],
"\" to install."));
return false;
diff --git a/Source/cmOutputRequiredFilesCommand.cxx b/Source/cmOutputRequiredFilesCommand.cxx
index 6a9a74c..75d1501 100644
--- a/Source/cmOutputRequiredFilesCommand.cxx
+++ b/Source/cmOutputRequiredFilesCommand.cxx
@@ -414,8 +414,7 @@ protected:
path += "/";
}
path += fname;
- if (cmSystemTools::FileExists(path, true) &&
- !cmSystemTools::FileIsDirectory(path)) {
+ if (cmSystemTools::FileExists(path, true)) {
std::string fp = cmSystemTools::CollapseFullPath(path);
this->DirectoryToFileToPathMap[extraPath][fname] = fp;
return fp;
@@ -428,8 +427,7 @@ protected:
path = path + "/";
}
path = path + fname;
- if (cmSystemTools::FileExists(path, true) &&
- !cmSystemTools::FileIsDirectory(path)) {
+ if (cmSystemTools::FileExists(path, true)) {
std::string fp = cmSystemTools::CollapseFullPath(path);
this->DirectoryToFileToPathMap[extraPath][fname] = fp;
return fp;