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

Side by Side Diff: chrome/common/chrome_paths.cc

Issue 2679133004: Log into the user-data-dir instead of Chrome's bundle. (Closed)
Patch Set: Created 3 years, 10 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
« 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/common/chrome_paths.h" 5 #include "chrome/common/chrome_paths.h"
6 6
7 #include "base/files/file_util.h" 7 #include "base/files/file_util.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 } // namespace 133 } // namespace
134 134
135 namespace chrome { 135 namespace chrome {
136 136
137 bool PathProvider(int key, base::FilePath* result) { 137 bool PathProvider(int key, base::FilePath* result) {
138 // Some keys are just aliases... 138 // Some keys are just aliases...
139 switch (key) { 139 switch (key) {
140 case chrome::DIR_APP: 140 case chrome::DIR_APP:
141 return PathService::Get(base::DIR_MODULE, result); 141 return PathService::Get(base::DIR_MODULE, result);
142 case chrome::DIR_LOGS: 142 case chrome::DIR_LOGS:
143 #ifdef NDEBUG 143 #ifdef NDEBUG
Nico 2017/02/10 21:36:18 i wondered why we even make this differentiation a
144 // Release builds write to the data dir 144 // Release builds write to the data dir
145 return PathService::Get(chrome::DIR_USER_DATA, result); 145 return PathService::Get(chrome::DIR_USER_DATA, result);
146 #else 146 #else
147 // Debug builds write next to the binary (in the build tree) 147 // Debug builds write next to the binary (in the build tree)
148 #if defined(OS_MACOSX) 148 #if defined(OS_MACOSX)
149 if (!PathService::Get(base::DIR_EXE, result)) 149 // Apps may not write into their own bundle.
150 return false;
151 if (base::mac::AmIBundled()) { 150 if (base::mac::AmIBundled()) {
152 // If we're called from chrome, dump it beside the app (outside the 151 return PathService::Get(chrome::DIR_USER_DATA, result);
153 // app bundle), if we're called from a unittest, we'll already
154 // outside the bundle so use the exe dir.
155 // exe_dir gave us .../Chromium.app/Contents/MacOS/Chromium.
156 *result = result->DirName();
157 *result = result->DirName();
158 *result = result->DirName();
159 } 152 }
160 return true; 153 return PathService::Get(base::DIR_EXE, result);
161 #else 154 #else
162 return PathService::Get(base::DIR_EXE, result); 155 return PathService::Get(base::DIR_EXE, result);
163 #endif // defined(OS_MACOSX) 156 #endif // defined(OS_MACOSX)
164 #endif // NDEBUG 157 #endif // NDEBUG
165 case chrome::FILE_RESOURCE_MODULE: 158 case chrome::FILE_RESOURCE_MODULE:
166 return PathService::Get(base::FILE_MODULE, result); 159 return PathService::Get(base::FILE_MODULE, result);
167 } 160 }
168 161
169 // Assume that we will not need to create the directory if it does not exist. 162 // Assume that we will not need to create the directory if it does not exist.
170 // This flag can be set to true for the cases where we want to create it. 163 // This flag can be set to true for the cases where we want to create it.
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 593
601 void SetInvalidSpecifiedUserDataDir(const base::FilePath& user_data_dir) { 594 void SetInvalidSpecifiedUserDataDir(const base::FilePath& user_data_dir) {
602 g_invalid_specified_user_data_dir.Get() = user_data_dir; 595 g_invalid_specified_user_data_dir.Get() = user_data_dir;
603 } 596 }
604 597
605 const base::FilePath& GetInvalidSpecifiedUserDataDir() { 598 const base::FilePath& GetInvalidSpecifiedUserDataDir() {
606 return g_invalid_specified_user_data_dir.Get(); 599 return g_invalid_specified_user_data_dir.Get();
607 } 600 }
608 601
609 } // namespace chrome 602 } // namespace chrome
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