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

Function EmptyBinaryDirectory

Source/CTest/cmCTestEmptyBinaryDirectoryCommand.cxx:52–84  ·  view source on GitHub ↗

* Empty Binary Directory */

Source from the content-addressed store, hash-verified

50 * Empty Binary Directory
51 */
52bool EmptyBinaryDirectory(std::string const& sname, std::string& err)
53{
54 // try to avoid deleting root
55 if (sname.size() < 2) {
56 err = "path too short";
57 return false;
58 }
59
60 // consider non existing target directory a success
61 if (!cmSystemTools::FileExists(sname)) {
62 return true;
63 }
64
65 // try to avoid deleting directories that we shouldn't
66 std::string check = cmStrCat(sname, "/CMakeCache.txt");
67
68 if (!cmSystemTools::FileExists(check)) {
69 err = "path does not contain an existing CMakeCache.txt file";
70 return false;
71 }
72
73 cmsys::Status status;
74 for (int i = 0; i < 5; ++i) {
75 status = TryToRemoveBinaryDirectoryOnce(sname);
76 if (status) {
77 return true;
78 }
79 cmSystemTools::Delay(100);
80 }
81
82 err = status.GetString();
83 return false;
84}
85
86} // namespace
87

Callers 1

Calls 5

FileExistsFunction · 0.50
cmStrCatFunction · 0.50
sizeMethod · 0.45
GetStringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…