Returns the name of the requested output file, or the default if none was explicitly specified.
| 1886 | // Returns the name of the requested output file, or the default if none |
| 1887 | // was explicitly specified. |
| 1888 | std::string UnitTestOptions::GetAbsolutePathToOutputFile() { |
| 1889 | const char* const gtest_output_flag = GTEST_FLAG(output).c_str(); |
| 1890 | if (gtest_output_flag == NULL) |
| 1891 | return ""; |
| 1892 | |
| 1893 | const char* const colon = strchr(gtest_output_flag, ':'); |
| 1894 | if (colon == NULL) |
| 1895 | return internal::FilePath::ConcatPaths( |
| 1896 | internal::FilePath( |
| 1897 | UnitTest::GetInstance()->original_working_dir()), |
| 1898 | internal::FilePath(kDefaultOutputFile)).string(); |
| 1899 | |
| 1900 | internal::FilePath output_name(colon + 1); |
| 1901 | if (!output_name.IsAbsolutePath()) |
| 1902 | // TODO(wan@google.com): on Windows \some\path is not an absolute |
| 1903 | // path (as its meaning depends on the current drive), yet the |
| 1904 | // following logic for turning it into an absolute path is wrong. |
| 1905 | // Fix it. |
| 1906 | output_name = internal::FilePath::ConcatPaths( |
| 1907 | internal::FilePath(UnitTest::GetInstance()->original_working_dir()), |
| 1908 | internal::FilePath(colon + 1)); |
| 1909 | |
| 1910 | if (!output_name.IsDirectory()) |
| 1911 | return output_name.string(); |
| 1912 | |
| 1913 | internal::FilePath result(internal::FilePath::GenerateUniqueFileName( |
| 1914 | output_name, internal::GetCurrentExecutableName(), |
| 1915 | GetOutputFormat().c_str())); |
| 1916 | return result.string(); |
| 1917 | } |
| 1918 | |
| 1919 | // Returns true iff the wildcard pattern matches the string. The |
| 1920 | // first ':' or '\0' character in pattern marks the end of it. |
nothing calls this directly
no test coverage detected