-------------------------------------------------------------------------
| 84 | |
| 85 | //------------------------------------------------------------------------- |
| 86 | File* UnifiedDiffCoverageFilter::SearchFile(const std::filesystem::path& path) |
| 87 | { |
| 88 | if (path == lastPath_) |
| 89 | return lastFile_; |
| 90 | |
| 91 | try |
| 92 | { |
| 93 | auto file = pathMatcher_.Match(path); |
| 94 | lastFile_ = file; |
| 95 | } |
| 96 | catch (const AmbiguousPathException& e) |
| 97 | { |
| 98 | std::ostringstream ostr; |
| 99 | |
| 100 | ostr << "A path is ambiguous in the unified diff file." << std::endl; |
| 101 | ostr << e.GetPostFixPath() << " can be either " << e.GetFirstPossiblePath(); |
| 102 | ostr << " or " << e.GetSecondPossiblePath() << std::endl; |
| 103 | ostr << "Please specify root folder. See help for more information."; |
| 104 | |
| 105 | throw std::runtime_error(ostr.str()); |
| 106 | } |
| 107 | |
| 108 | lastPath_ = path; |
| 109 | return lastFile_; |
| 110 | } |
| 111 | |
| 112 | //------------------------------------------------------------------------- |
| 113 | std::vector<std::filesystem::path> UnifiedDiffCoverageFilter::GetUnmatchedPaths() const |