From 372701a8728cad7cffbd59403eb21d76352c1151 Mon Sep 17 00:00:00 2001 From: "buildbot@webrtc.org" Date: Wed, 14 May 2014 20:27:59 +0000 Subject: [PATCH] (Auto)update libjingle 67023528-> 67036361 git-svn-id: http://webrtc.googlecode.com/svn/trunk@6160 4adac7df-926f-26a2-2b94-8c16560cd09d --- talk/base/gunit.h | 1 + talk/base/unittest_main.cc | 34 ++++++++++++++++++---------------- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/talk/base/gunit.h b/talk/base/gunit.h index 3a0321468..181150a87 100644 --- a/talk/base/gunit.h +++ b/talk/base/gunit.h @@ -107,6 +107,7 @@ class Pathname; } \ } while (0); +talk_base::Pathname GetGoogle3Directory(); talk_base::Pathname GetTalkDirectory(); #endif // TALK_BASE_GUNIT_H_ diff --git a/talk/base/unittest_main.cc b/talk/base/unittest_main.cc index bca3671b0..94f7f6c74 100644 --- a/talk/base/unittest_main.cc +++ b/talk/base/unittest_main.cc @@ -47,28 +47,30 @@ int TestCrtReportHandler(int report_type, char* msg, int* retval) { } #endif // WIN32 -talk_base::Pathname GetTalkDirectory() { - // Locate talk directory. +// Look in parent dir for parallel directory. +talk_base::Pathname GetSiblingDirectory( + const std::string& parallel_dir) { talk_base::Pathname path = talk_base::Filesystem::GetCurrentDirectory(); - std::string talk_folder_name("talk"); - talk_folder_name += path.folder_delimiter(); - while (path.folder_name() != talk_folder_name && !path.empty()) { + while (!path.empty()) { + talk_base::Pathname potential_parallel_dir = path; + potential_parallel_dir.AppendFolder(parallel_dir); + if (talk_base::Filesystem::IsFolder(potential_parallel_dir)) { + return potential_parallel_dir; + } + path.SetFolder(path.parent_folder()); } - - // If not running inside "talk" folder, then assume running in its parent - // folder. - if (path.empty()) { - path = talk_base::Filesystem::GetCurrentDirectory(); - path.AppendFolder("talk"); - // Make sure the folder exist. - if (!talk_base::Filesystem::IsFolder(path)) { - path.clear(); - } - } return path; } +talk_base::Pathname GetGoogle3Directory() { + return GetSiblingDirectory("google3"); +} + +talk_base::Pathname GetTalkDirectory() { + return GetSiblingDirectory("talk"); +} + int main(int argc, char** argv) { testing::InitGoogleTest(&argc, argv); FlagList::SetFlagsFromCommandLine(&argc, argv, false);