summaryrefslogtreecommitdiffstats
path: root/base/base_paths.cc
diff options
context:
space:
mode:
authormaruel@google.com <maruel@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-06 20:35:17 +0000
committermaruel@google.com <maruel@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-06 20:35:17 +0000
commitc9046afea46a4b8252392adced73f3d2a9fb354e (patch)
treec557a80884a379eecf170e3cf88acee77bc4d837 /base/base_paths.cc
parenta4930c88e7fb14ba66340cbe393fcdf4c668e41c (diff)
downloadchromium_src-c9046afea46a4b8252392adced73f3d2a9fb354e.zip
chromium_src-c9046afea46a4b8252392adced73f3d2a9fb354e.tar.gz
chromium_src-c9046afea46a4b8252392adced73f3d2a9fb354e.tar.bz2
Fix base::DIR_SOURCE_ROOT path calculation.
Add missing header files to base.vcproj. Fix thread local storage implicit destructor call on Windows x64. Fix build compilation issues in x64 with third party headers. Fix Pickle for x64, the header doesn't need to be size_t, uint32 ought to be sufficient for the object. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@450 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/base_paths.cc')
-rw-r--r--base/base_paths.cc36
1 files changed, 33 insertions, 3 deletions
diff --git a/base/base_paths.cc b/base/base_paths.cc
index ed0a489..2c69cef 100644
--- a/base/base_paths.cc
+++ b/base/base_paths.cc
@@ -31,9 +31,23 @@
#include "base/file_util.h"
#include "base/path_service.h"
+#include "base/string_util.h"
namespace base {
+namespace {
+
+// List of directory name prefixes to skip when calculating
+// base::DIR_SOURCE_ROOT.
+const wchar_t* const kPathToStrip[] = {
+ L"release",
+ L"debug",
+ L"win32",
+ L"x64",
+};
+
+} // namespace
+
bool PathProvider(int key, std::wstring* result) {
// NOTE: DIR_CURRENT is a special cased in PathService::Get
@@ -52,10 +66,26 @@ bool PathProvider(int key, std::wstring* result) {
return false;
break;
case base::DIR_SOURCE_ROOT:
- // By default, unit tests execute two levels deep from the source root.
- // For example: chrome/{Debug|Release}/ui_tests.exe
PathProvider(base::DIR_EXE, &cur);
- file_util::UpOneDirectory(&cur);
+ for (;;) {
+ bool found = false;
+ std::wstring bottom_dir(file_util::GetFilenameFromPath(cur));
+ for (int i = 0; i < arraysize(kPathToStrip); ++i) {
+ if (0 == wcsncmp(bottom_dir.c_str(),
+ kPathToStrip[i],
+ wcslen(kPathToStrip[i]))) {
+ found = true;
+ break;
+ }
+ }
+ if (!found)
+ break;
+
+ // Skip this directory.
+ file_util::UpOneDirectory(&cur);
+ }
+
+ // Then skip one more for the solution directory.
file_util::UpOneDirectory(&cur);
break;
default: