Returns the name of the requested output file, or the default if none was explicitly specified.
| 656 | // Returns the name of the requested output file, or the default if none |
| 657 | // was explicitly specified. |
| 658 | std::string UnitTestOptions::GetAbsolutePathToOutputFile() { |
| 659 | std::string s = GTEST_FLAG_GET(output); |
| 660 | const char* const gtest_output_flag = s.c_str(); |
| 661 | |
| 662 | std::string format = GetOutputFormat(); |
| 663 | if (format.empty()) format = std::string(kDefaultOutputFormat); |
| 664 | |
| 665 | const char* const colon = strchr(gtest_output_flag, ':'); |
| 666 | if (colon == nullptr) |
| 667 | return internal::FilePath::MakeFileName( |
| 668 | internal::FilePath( |
| 669 | UnitTest::GetInstance()->original_working_dir()), |
| 670 | internal::FilePath(kDefaultOutputFile), 0, format.c_str()) |
| 671 | .string(); |
| 672 | |
| 673 | internal::FilePath output_name(colon + 1); |
| 674 | if (!output_name.IsAbsolutePath()) |
| 675 | output_name = internal::FilePath::ConcatPaths( |
| 676 | internal::FilePath(UnitTest::GetInstance()->original_working_dir()), |
| 677 | internal::FilePath(colon + 1)); |
| 678 | |
| 679 | if (!output_name.IsDirectory()) return output_name.string(); |
| 680 | |
| 681 | internal::FilePath result(internal::FilePath::GenerateUniqueFileName( |
| 682 | output_name, internal::GetCurrentExecutableName(), |
| 683 | GetOutputFormat().c_str())); |
| 684 | return result.string(); |
| 685 | } |
| 686 | #endif // GTEST_HAS_FILE_SYSTEM |
| 687 | |
| 688 | // Returns true if and only if the wildcard pattern matches the string. Each |
nothing calls this directly
no test coverage detected