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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/base_paths.cc
diff --git a/base/base_paths.cc b/base/base_paths.cc
index 7076ec3be15fb66218efbd768f1caa2424ca11a6..31bc55401af4a8087b3319ba4f35d796e918c376 100644
--- a/base/base_paths.cc
+++ b/base/base_paths.cc
@@ -29,15 +29,18 @@ bool PathProvider(int key, FilePath* result) {
case base::DIR_HOME:
*result = GetHomeDir();
return true;
- case DIR_TEST_DATA:
- if (!PathService::Get(DIR_SOURCE_ROOT, result))
+ case DIR_TEST_DATA: {
+ FilePath test_data_path;
+ if (!PathService::Get(DIR_SOURCE_ROOT, &test_data_path))
return false;
- *result = result->Append(FILE_PATH_LITERAL("base"));
- *result = result->Append(FILE_PATH_LITERAL("test"));
- *result = result->Append(FILE_PATH_LITERAL("data"));
- if (!PathExists(*result)) // We don't want to create this.
+ test_data_path = test_data_path.Append(FILE_PATH_LITERAL("base"));
+ test_data_path = test_data_path.Append(FILE_PATH_LITERAL("test"));
+ test_data_path = test_data_path.Append(FILE_PATH_LITERAL("data"));
+ if (!PathExists(test_data_path)) // We don't want to create this.
return false;
+ *result = test_data_path;
return true;
+ }
default:
return false;
}
« 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