Rebase webrtc/base 6129:6163 (svn diff -r 6129:6163 http://webrtc.googlecode.com/svn/trunk/talk/base apply diff manually)

BUG=N/A
R=andrew@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/15519004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@6175 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
henrike@webrtc.org
2014-05-15 16:33:04 +00:00
parent 6bfd6196ff
commit cfdf420e21
4 changed files with 32 additions and 33 deletions

View File

@ -28,6 +28,7 @@
#include "webrtc/base/common.h"
#include "webrtc/base/gunit.h"
#include "webrtc/base/nethelpers.h"
#include "webrtc/base/pathutils.h"
#include "webrtc/base/stream.h"
#include "webrtc/base/stringencode.h"
#include "webrtc/base/stringutils.h"
@ -434,6 +435,30 @@ inline bool ReadFile(const char* filename, std::string* contents) {
return success;
}
// Look in parent dir for parallel directory.
inline rtc::Pathname GetSiblingDirectory(
const std::string& parallel_dir) {
rtc::Pathname path = rtc::Filesystem::GetCurrentDirectory();
while (!path.empty()) {
rtc::Pathname potential_parallel_dir = path;
potential_parallel_dir.AppendFolder(parallel_dir);
if (rtc::Filesystem::IsFolder(potential_parallel_dir)) {
return potential_parallel_dir;
}
path.SetFolder(path.parent_folder());
}
return path;
}
inline rtc::Pathname GetGoogle3Directory() {
return GetSiblingDirectory("google3");
}
inline rtc::Pathname GetTalkDirectory() {
return GetSiblingDirectory("talk");
}
///////////////////////////////////////////////////////////////////////////////
// Unittest predicates which are similar to STREQ, but for raw memory
///////////////////////////////////////////////////////////////////////////////