| 404 | } |
| 405 | |
| 406 | bool 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 | |
| 441 | bool cmArchiveWrite::AddFile(char const* file, size_t skip, char const* prefix) |
| 442 | { |