From a32fc79c9af648cd500f9850975d04ae49ebda3f Mon Sep 17 00:00:00 2001 From: "zhanyong.wan" Date: Mon, 26 Jan 2009 21:04:36 +0000 Subject: [PATCH] Simplifies gtest's implementation by using an existing API to get the original working directory. --- src/gtest.cc | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/gtest.cc b/src/gtest.cc index d6be608a..903dcd94 100644 --- a/src/gtest.cc +++ b/src/gtest.cc @@ -289,7 +289,6 @@ Mutex g_linked_ptr_mutex(Mutex::NO_CONSTRUCTOR_NEEDED_FOR_STATIC_MUTEX); // Application pathname gotten in InitGoogleTest. String g_executable_path; -String g_original_working_dir; // Returns the current application's name, removing directory path if that // is present. @@ -328,7 +327,8 @@ String UnitTestOptions::GetAbsolutePathToOutputFile() { const char* const colon = strchr(gtest_output_flag, ':'); if (colon == NULL) return String(internal::FilePath::ConcatPaths( - internal::FilePath(g_original_working_dir), + internal::FilePath( + UnitTest::GetInstance()->original_working_dir()), internal::FilePath(kDefaultOutputFile)).ToString() ); internal::FilePath output_name(colon + 1); @@ -338,8 +338,8 @@ String UnitTestOptions::GetAbsolutePathToOutputFile() { // following logic for turning it into an absolute path is wrong. // Fix it. output_name = internal::FilePath::ConcatPaths( - internal::FilePath(g_original_working_dir), - internal::FilePath(colon + 1)); + internal::FilePath(UnitTest::GetInstance()->original_working_dir()), + internal::FilePath(colon + 1)); if (!output_name.IsDirectory()) return output_name.ToString(); @@ -3938,8 +3938,6 @@ void InitGoogleTestImpl(int* argc, CharType** argv) { if (*argc <= 0) return; internal::g_executable_path = internal::StreamableToString(argv[0]); - internal::g_original_working_dir = - internal::FilePath::GetCurrentDir().ToString(); #ifdef GTEST_HAS_DEATH_TEST g_argvs.clear();