Returns the name of the requested output file, or the default if none was explicitly specified.
| 1698 | // Returns the name of the requested output file, or the default if none |
| 1699 | // was explicitly specified. |
| 1700 | String UnitTestOptions::GetAbsolutePathToOutputFile() { |
| 1701 | const char* const gtest_output_flag = GTEST_FLAG(output).c_str(); |
| 1702 | if (gtest_output_flag == NULL) |
| 1703 | return String(""); |
| 1704 | |
| 1705 | const char* const colon = strchr(gtest_output_flag, ':'); |
| 1706 | if (colon == NULL) |
| 1707 | return String(internal::FilePath::ConcatPaths( |
| 1708 | internal::FilePath( |
| 1709 | UnitTest::GetInstance()->original_working_dir()), |
| 1710 | internal::FilePath(kDefaultOutputFile)).ToString() ); |
| 1711 | |
| 1712 | internal::FilePath output_name(colon + 1); |
| 1713 | if (!output_name.IsAbsolutePath()) |
| 1714 | // TODO(wan@google.com): on Windows \some\path is not an absolute |
| 1715 | // path (as its meaning depends on the current drive), yet the |
| 1716 | // following logic for turning it into an absolute path is wrong. |
| 1717 | // Fix it. |
| 1718 | output_name = internal::FilePath::ConcatPaths( |
| 1719 | internal::FilePath(UnitTest::GetInstance()->original_working_dir()), |
| 1720 | internal::FilePath(colon + 1)); |
| 1721 | |
| 1722 | if (!output_name.IsDirectory()) |
| 1723 | return output_name.ToString(); |
| 1724 | |
| 1725 | internal::FilePath result(internal::FilePath::GenerateUniqueFileName( |
| 1726 | output_name, internal::GetCurrentExecutableName(), |
| 1727 | GetOutputFormat().c_str())); |
| 1728 | return result.ToString(); |
| 1729 | } |
| 1730 | |
| 1731 | // Returns true iff the wildcard pattern matches the string. The |
| 1732 | // first ':' or '\0' character in pattern marks the end of it. |
nothing calls this directly
no test coverage detected