Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(266)

Side by Side Diff: base/base_paths_mac.mm

Issue 8585029: Make GetWebKitRootDirFilePath smarter about where the WebKit root is relative to the chromium root (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/base_paths_mac.h" 5 #include "base/base_paths_mac.h"
6 6
7 #include <dlfcn.h> 7 #include <dlfcn.h>
8 #import <Foundation/Foundation.h> 8 #import <Foundation/Foundation.h>
9 #include <mach-o/dyld.h> 9 #include <mach-o/dyld.h>
10 10
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/file_path.h" 12 #include "base/file_path.h"
13 #include "base/file_util.h" 13 #include "base/file_util.h"
14 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "base/mac/foundation_util.h" 15 #include "base/mac/foundation_util.h"
16 #include "base/path_service.h" 16 #include "base/path_service.h"
17 #include "base/string_util.h" 17 #include "base/string_util.h"
18 18
19 namespace { 19 namespace {
20 // The name of this file relative to the source root. This is used for checking
21 // that the source checkout is in the correct place.
22 static const char kThisSourceFile[] = "base/base_paths_mac.mm";
20 23
21 void GetNSExecutablePath(FilePath* path) { 24 void GetNSExecutablePath(FilePath* path) {
22 DCHECK(path); 25 DCHECK(path);
23 // Executable path can have relative references ("..") depending on 26 // Executable path can have relative references ("..") depending on
24 // how the app was launched. 27 // how the app was launched.
25 uint32_t executable_length = 0; 28 uint32_t executable_length = 0;
26 _NSGetExecutablePath(NULL, &executable_length); 29 _NSGetExecutablePath(NULL, &executable_length);
27 DCHECK_GT(executable_length, 1u); 30 DCHECK_GT(executable_length, 1u);
28 std::string executable_path; 31 std::string executable_path;
29 int rv = _NSGetExecutablePath(WriteInto(&executable_path, executable_length), 32 int rv = _NSGetExecutablePath(WriteInto(&executable_path, executable_length),
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 if (base::mac::AmIBundled()) { 74 if (base::mac::AmIBundled()) {
72 // The bundled app executables (Chromium, TestShell, etc) live five 75 // The bundled app executables (Chromium, TestShell, etc) live five
73 // levels down, eg: 76 // levels down, eg:
74 // src/xcodebuild/{Debug|Release}/Chromium.app/Contents/MacOS/Chromium 77 // src/xcodebuild/{Debug|Release}/Chromium.app/Contents/MacOS/Chromium
75 *result = result->DirName().DirName().DirName().DirName().DirName(); 78 *result = result->DirName().DirName().DirName().DirName().DirName();
76 } else { 79 } else {
77 // Unit tests execute two levels deep from the source root, eg: 80 // Unit tests execute two levels deep from the source root, eg:
78 // src/xcodebuild/{Debug|Release}/base_unittests 81 // src/xcodebuild/{Debug|Release}/base_unittests
79 *result = result->DirName().DirName(); 82 *result = result->DirName().DirName();
80 } 83 }
84 // In a case of a WebKit-only checkout, using make instead of
85 // xcodebuild, we should return <root of
86 // checkout>/Source/WebKit/chromium.
87 // FIXME(thakis): try to move the xcodebuild directory up two levels.
Nico 2012/01/19 16:06:49 s/FIXME/TODO
jochen (gone - plz use gerrit) 2012/01/19 16:31:20 Done.
88 // http://crbug.com/110455
89 if (!file_util::PathExists(result->Append(kThisSourceFile)))
90 *result = result->Append("Source/WebKit/chromium");
Nico 2012/01/19 16:06:49 CHECK(file_util::PAthExists(result->Append(kThisSo
jochen (gone - plz use gerrit) 2012/01/19 16:31:20 Done.
81 return true; 91 return true;
82 } 92 }
83 default: 93 default:
84 return false; 94 return false;
85 } 95 }
86 } 96 }
87 97
88 } // namespace base 98 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698