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

Side by Side Diff: base/base_paths.cc

Issue 1513823002: Fix PathProvider to not modify result when DIR_TEST_DATA does not exist (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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.h" 5 #include "base/base_paths.h"
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 10
(...skipping 11 matching lines...) Expand all
22 PathService::Get(FILE_MODULE, result); 22 PathService::Get(FILE_MODULE, result);
23 *result = result->DirName(); 23 *result = result->DirName();
24 return true; 24 return true;
25 case DIR_TEMP: 25 case DIR_TEMP:
26 if (!GetTempDir(result)) 26 if (!GetTempDir(result))
27 return false; 27 return false;
28 return true; 28 return true;
29 case base::DIR_HOME: 29 case base::DIR_HOME:
30 *result = GetHomeDir(); 30 *result = GetHomeDir();
31 return true; 31 return true;
32 case DIR_TEST_DATA: 32 case DIR_TEST_DATA: {
33 if (!PathService::Get(DIR_SOURCE_ROOT, result)) 33 FilePath test_data_path;
34 if (!PathService::Get(DIR_SOURCE_ROOT, &test_data_path))
34 return false; 35 return false;
35 *result = result->Append(FILE_PATH_LITERAL("base")); 36 test_data_path = test_data_path.Append(FILE_PATH_LITERAL("base"));
36 *result = result->Append(FILE_PATH_LITERAL("test")); 37 test_data_path = test_data_path.Append(FILE_PATH_LITERAL("test"));
37 *result = result->Append(FILE_PATH_LITERAL("data")); 38 test_data_path = test_data_path.Append(FILE_PATH_LITERAL("data"));
38 if (!PathExists(*result)) // We don't want to create this. 39 if (!PathExists(test_data_path)) // We don't want to create this.
39 return false; 40 return false;
41 *result = test_data_path;
40 return true; 42 return true;
43 }
41 default: 44 default:
42 return false; 45 return false;
43 } 46 }
44 } 47 }
45 48
46 } // namespace base 49 } // 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