MCPcopy Create free account
hub / github.com/Kitware/CMake / CheckDirectoryForName

Method CheckDirectoryForName

Source/cmFindProgramCommand.cxx:85–111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

83 });
84 }
85 bool CheckDirectoryForName(std::string const& path, std::string const& name)
86 {
87 return std::any_of(this->Extensions.begin(), this->Extensions.end(),
88 [this, &path, &name](std::string const& ext) -> bool {
89 if (!ext.empty() && cmHasSuffix(name, ext)) {
90 return false;
91 }
92 std::string testNameExt = cmStrCat(name, ext);
93 std::string testPath =
94 cmSystemTools::CollapseFullPath(testNameExt, path);
95 if (this->FileIsExecutable(testPath)) {
96 testPath =
97 cmSystemTools::ToNormalizedPathOnDisk(testPath);
98 if (this->FindBase->Validate(testPath)) {
99 this->BestPath = testPath;
100 if (this->DebugState) {
101 this->DebugState->FoundAt(testPath);
102 }
103 return true;
104 }
105 }
106 if (this->DebugState) {
107 this->DebugState->FailedAt(testPath);
108 }
109 return false;
110 });
111 }
112 bool FileIsExecutable(std::string const& file) const
113 {
114 if (!this->FileIsExecutableCMP0109(file)) {

Callers 2

CheckCompoundNamesMethod · 0.95
CheckDirectoryMethod · 0.95

Calls 9

FileIsExecutableMethod · 0.95
cmHasSuffixFunction · 0.85
FoundAtMethod · 0.80
FailedAtMethod · 0.80
cmStrCatFunction · 0.70
beginMethod · 0.45
endMethod · 0.45
emptyMethod · 0.45
ValidateMethod · 0.45

Tested by

no test coverage detected