Returns the name of the requested output file, or the default if none was explicitly specified.
| 1933 | // Returns the name of the requested output file, or the default if none |
| 1934 | // was explicitly specified. |
| 1935 | std::string UnitTestOptions::GetAbsolutePathToOutputFile() { |
| 1936 | const char* const gtest_output_flag = GTEST_FLAG(output).c_str(); |
| 1937 | |
| 1938 | std::string format = GetOutputFormat(); |
| 1939 | if (format.empty()) |
| 1940 | format = std::string(kDefaultOutputFormat); |
| 1941 | |
| 1942 | const char* const colon = strchr(gtest_output_flag, ':'); |
| 1943 | if (colon == nullptr) |
| 1944 | return internal::FilePath::MakeFileName( |
| 1945 | internal::FilePath( |
| 1946 | UnitTest::GetInstance()->original_working_dir()), |
| 1947 | internal::FilePath(kDefaultOutputFile), 0, |
| 1948 | format.c_str()).string(); |
| 1949 | |
| 1950 | internal::FilePath output_name(colon + 1); |
| 1951 | if (!output_name.IsAbsolutePath()) |
| 1952 | output_name = internal::FilePath::ConcatPaths( |
| 1953 | internal::FilePath(UnitTest::GetInstance()->original_working_dir()), |
| 1954 | internal::FilePath(colon + 1)); |
| 1955 | |
| 1956 | if (!output_name.IsDirectory()) |
| 1957 | return output_name.string(); |
| 1958 | |
| 1959 | internal::FilePath result(internal::FilePath::GenerateUniqueFileName( |
| 1960 | output_name, internal::GetCurrentExecutableName(), |
| 1961 | GetOutputFormat().c_str())); |
| 1962 | return result.string(); |
| 1963 | } |
| 1964 | |
| 1965 | // Returns true iff the wildcard pattern matches the string. The |
| 1966 | // first ':' or '\0' character in pattern marks the end of it. |
nothing calls this directly
no test coverage detected