mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-19 19:43:23 +08:00
Source: Remove redundant FileIsDirectory checks
This commit is contained in:
@@ -1711,8 +1711,7 @@ std::string cmCTestTestHandler::FindExecutable(
|
|||||||
// now look in the paths we specified above
|
// now look in the paths we specified above
|
||||||
for (unsigned int ai = 0; ai < attempted.size() && fullPath.empty(); ++ai) {
|
for (unsigned int ai = 0; ai < attempted.size() && fullPath.empty(); ++ai) {
|
||||||
// first check without exe extension
|
// first check without exe extension
|
||||||
if (cmSystemTools::FileExists(attempted[ai]) &&
|
if (cmSystemTools::FileExists(attempted[ai], true)) {
|
||||||
!cmSystemTools::FileIsDirectory(attempted[ai])) {
|
|
||||||
fullPath = cmSystemTools::CollapseFullPath(attempted[ai]);
|
fullPath = cmSystemTools::CollapseFullPath(attempted[ai]);
|
||||||
resultingConfig = attemptedConfigs[ai];
|
resultingConfig = attemptedConfigs[ai];
|
||||||
}
|
}
|
||||||
@@ -1721,8 +1720,7 @@ std::string cmCTestTestHandler::FindExecutable(
|
|||||||
failed.push_back(attempted[ai]);
|
failed.push_back(attempted[ai]);
|
||||||
tempPath =
|
tempPath =
|
||||||
cmStrCat(attempted[ai], cmSystemTools::GetExecutableExtension());
|
cmStrCat(attempted[ai], cmSystemTools::GetExecutableExtension());
|
||||||
if (cmSystemTools::FileExists(tempPath) &&
|
if (cmSystemTools::FileExists(tempPath, true)) {
|
||||||
!cmSystemTools::FileIsDirectory(tempPath)) {
|
|
||||||
fullPath = cmSystemTools::CollapseFullPath(tempPath);
|
fullPath = cmSystemTools::CollapseFullPath(tempPath);
|
||||||
resultingConfig = attemptedConfigs[ai];
|
resultingConfig = attemptedConfigs[ai];
|
||||||
} else {
|
} else {
|
||||||
|
@@ -1004,8 +1004,7 @@ int cmCTest::ProcessSteps()
|
|||||||
for (kk = 0; kk < d.GetNumberOfFiles(); kk++) {
|
for (kk = 0; kk < d.GetNumberOfFiles(); kk++) {
|
||||||
const char* file = d.GetFile(kk);
|
const char* file = d.GetFile(kk);
|
||||||
std::string fullname = notes_dir + "/" + file;
|
std::string fullname = notes_dir + "/" + file;
|
||||||
if (cmSystemTools::FileExists(fullname) &&
|
if (cmSystemTools::FileExists(fullname, true)) {
|
||||||
!cmSystemTools::FileIsDirectory(fullname)) {
|
|
||||||
if (!this->Impl->NotesFiles.empty()) {
|
if (!this->Impl->NotesFiles.empty()) {
|
||||||
this->Impl->NotesFiles += ";";
|
this->Impl->NotesFiles += ";";
|
||||||
}
|
}
|
||||||
|
@@ -1837,8 +1837,7 @@ bool HandleDirectoryMode(std::vector<std::string> const& args,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Make sure the name is a directory.
|
// Make sure the name is a directory.
|
||||||
if (cmSystemTools::FileExists(dir) &&
|
if (cmSystemTools::FileExists(dir, true)) {
|
||||||
!cmSystemTools::FileIsDirectory(dir)) {
|
|
||||||
status.SetError(cmStrCat(args[0], " given non-directory \"", args[i],
|
status.SetError(cmStrCat(args[0], " given non-directory \"", args[i],
|
||||||
"\" to install."));
|
"\" to install."));
|
||||||
return false;
|
return false;
|
||||||
|
@@ -414,8 +414,7 @@ protected:
|
|||||||
path += "/";
|
path += "/";
|
||||||
}
|
}
|
||||||
path += fname;
|
path += fname;
|
||||||
if (cmSystemTools::FileExists(path, true) &&
|
if (cmSystemTools::FileExists(path, true)) {
|
||||||
!cmSystemTools::FileIsDirectory(path)) {
|
|
||||||
std::string fp = cmSystemTools::CollapseFullPath(path);
|
std::string fp = cmSystemTools::CollapseFullPath(path);
|
||||||
this->DirectoryToFileToPathMap[extraPath][fname] = fp;
|
this->DirectoryToFileToPathMap[extraPath][fname] = fp;
|
||||||
return fp;
|
return fp;
|
||||||
@@ -428,8 +427,7 @@ protected:
|
|||||||
path = path + "/";
|
path = path + "/";
|
||||||
}
|
}
|
||||||
path = path + fname;
|
path = path + fname;
|
||||||
if (cmSystemTools::FileExists(path, true) &&
|
if (cmSystemTools::FileExists(path, true)) {
|
||||||
!cmSystemTools::FileIsDirectory(path)) {
|
|
||||||
std::string fp = cmSystemTools::CollapseFullPath(path);
|
std::string fp = cmSystemTools::CollapseFullPath(path);
|
||||||
this->DirectoryToFileToPathMap[extraPath][fname] = fp;
|
this->DirectoryToFileToPathMap[extraPath][fname] = fp;
|
||||||
return fp;
|
return fp;
|
||||||
|
Reference in New Issue
Block a user