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

Method AddPath

Source/cmArchiveWrite.cxx:406–439  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

404}
405
406bool cmArchiveWrite::AddPath(char const* path, size_t skip, char const* prefix,
407 bool recursive)
408{
409 if (strcmp(path, ".") != 0 ||
410 (this->Format != "zip" && this->Format != "7zip")) {
411 if (!this->AddFile(path, skip, prefix)) {
412 return false;
413 }
414 }
415 if ((!cmSystemTools::FileIsDirectory(path) || !recursive) ||
416 cmSystemTools::FileIsSymlink(path)) {
417 return true;
418 }
419 cmsys::Directory d;
420 if (d.Load(path)) {
421 std::string next = cmStrCat(path, '/');
422 if (next == "./" && (this->Format == "zip" || this->Format == "7zip")) {
423 next.clear();
424 }
425 std::string::size_type end = next.size();
426 unsigned long n = d.GetNumberOfFiles();
427 for (unsigned long i = 0; i < n; ++i) {
428 char const* file = d.GetFile(i);
429 if (strcmp(file, ".") != 0 && strcmp(file, "..") != 0) {
430 next.erase(end);
431 next += file;
432 if (!this->AddPath(next.c_str(), skip, prefix)) {
433 return false;
434 }
435 }
436 }
437 }
438 return true;
439}
440
441bool cmArchiveWrite::AddFile(char const* file, size_t skip, char const* prefix)
442{

Callers 1

AddMethod · 0.95

Calls 7

AddFileMethod · 0.95
eraseMethod · 0.80
c_strMethod · 0.80
cmStrCatFunction · 0.70
LoadMethod · 0.45
clearMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected