MCPcopy Create free account
hub / github.com/OpenZWave/open-zwave / GetAbsolutePathToOutputFile

Method GetAbsolutePathToOutputFile

cpp/test/src/gtest.cc:426–455  ·  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

424// Returns the name of the requested output file, or the default if none
425// was explicitly specified.
426std::string UnitTestOptions::GetAbsolutePathToOutputFile() {
427 const char* const gtest_output_flag = GTEST_FLAG(output).c_str();
428 if (gtest_output_flag == NULL)
429 return "";
430
431 const char* const colon = strchr(gtest_output_flag, ':');
432 if (colon == NULL)
433 return internal::FilePath::ConcatPaths(
434 internal::FilePath(
435 UnitTest::GetInstance()->original_working_dir()),
436 internal::FilePath(kDefaultOutputFile)).string();
437
438 internal::FilePath output_name(colon + 1);
439 if (!output_name.IsAbsolutePath())
440 // TODO(wan@google.com): on Windows \some\path is not an absolute
441 // path (as its meaning depends on the current drive), yet the
442 // following logic for turning it into an absolute path is wrong.
443 // Fix it.
444 output_name = internal::FilePath::ConcatPaths(
445 internal::FilePath(UnitTest::GetInstance()->original_working_dir()),
446 internal::FilePath(colon + 1));
447
448 if (!output_name.IsDirectory())
449 return output_name.string();
450
451 internal::FilePath result(internal::FilePath::GenerateUniqueFileName(
452 output_name, internal::GetCurrentExecutableName(),
453 GetOutputFormat().c_str()));
454 return result.string();
455}
456
457// Returns true iff the wildcard pattern matches the string. The
458// first ':' or '\0' character in pattern marks the end of it.

Callers

nothing calls this directly

Calls 7

FilePathFunction · 0.85
GetCurrentExecutableNameFunction · 0.85
original_working_dirMethod · 0.80
IsAbsolutePathMethod · 0.80
IsDirectoryMethod · 0.80
GetInstanceFunction · 0.50
c_strMethod · 0.45

Tested by

no test coverage detected