MCPcopy Create free account
hub / github.com/EmbeddedRPC/erpc / GetAbsolutePathToOutputFile

Method GetAbsolutePathToOutputFile

test/common/gtest/gtest.cpp:1908–1937  ·  view source on GitHub ↗

Returns the name of the requested output file, or the default if none was explicitly specified.

Source from the content-addressed store, hash-verified

1906// Returns the name of the requested output file, or the default if none
1907// was explicitly specified.
1908std::string UnitTestOptions::GetAbsolutePathToOutputFile() {
1909 const char* const gtest_output_flag = GTEST_FLAG(output).c_str();
1910 if (gtest_output_flag == NULL)
1911 return "";
1912
1913 const char* const colon = strchr(gtest_output_flag, ':');
1914 if (colon == NULL)
1915 return internal::FilePath::ConcatPaths(
1916 internal::FilePath(
1917 UnitTest::GetInstance()->original_working_dir()),
1918 internal::FilePath(kDefaultOutputFile)).string();
1919
1920 internal::FilePath output_name(colon + 1);
1921 if (!output_name.IsAbsolutePath())
1922 // TODO(wan@google.com): on Windows \some\path is not an absolute
1923 // path (as its meaning depends on the current drive), yet the
1924 // following logic for turning it into an absolute path is wrong.
1925 // Fix it.
1926 output_name = internal::FilePath::ConcatPaths(
1927 internal::FilePath(UnitTest::GetInstance()->original_working_dir()),
1928 internal::FilePath(colon + 1));
1929
1930 if (!output_name.IsDirectory())
1931 return output_name.string();
1932
1933 internal::FilePath result(internal::FilePath::GenerateUniqueFileName(
1934 output_name, internal::GetCurrentExecutableName(),
1935 GetOutputFormat().c_str()));
1936 return result.string();
1937}
1938
1939// Returns true iff the wildcard pattern matches the string. The
1940// first ':' or '\0' character in pattern marks the end of it.

Callers

nothing calls this directly

Calls 5

FilePathFunction · 0.85
GetCurrentExecutableNameFunction · 0.85
original_working_dirMethod · 0.80
IsAbsolutePathMethod · 0.80
IsDirectoryMethod · 0.80

Tested by

no test coverage detected