| 643 | } |
| 644 | |
| 645 | bool cmCTest::OpenOutputFile(std::string const& path, std::string const& name, |
| 646 | cmGeneratedFileStream& stream, bool compress) |
| 647 | { |
| 648 | std::string testingDir = this->Impl->BinaryDir + "/Testing"; |
| 649 | if (!path.empty()) { |
| 650 | testingDir += "/" + path; |
| 651 | } |
| 652 | if (cmSystemTools::FileExists(testingDir)) { |
| 653 | if (!cmSystemTools::FileIsDirectory(testingDir)) { |
| 654 | cmCTestLog(this, ERROR_MESSAGE, |
| 655 | "File " << testingDir |
| 656 | << " is in the place of the testing directory" |
| 657 | << std::endl); |
| 658 | return false; |
| 659 | } |
| 660 | } else { |
| 661 | if (!cmSystemTools::MakeDirectory(testingDir)) { |
| 662 | cmCTestLog(this, ERROR_MESSAGE, |
| 663 | "Cannot create directory " << testingDir << std::endl); |
| 664 | return false; |
| 665 | } |
| 666 | } |
| 667 | std::string filename = cmStrCat(testingDir, '/', name); |
| 668 | stream.Open(filename); |
| 669 | if (!stream) { |
| 670 | cmCTestLog(this, ERROR_MESSAGE, |
| 671 | "Problem opening file: " << filename << std::endl); |
| 672 | return false; |
| 673 | } |
| 674 | if (compress) { |
| 675 | if (this->Impl->CompressXMLFiles) { |
| 676 | stream.SetCompression(true); |
| 677 | } |
| 678 | } |
| 679 | return true; |
| 680 | } |
| 681 | |
| 682 | bool cmCTest::AddIfExists(Part part, std::string const& file) |
| 683 | { |
no test coverage detected