| // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| #include "base/base_paths.h" |
| #include "base/files/file_path.h" |
| #include "base/files/file_util.h" |
| #include "base/path_service.h" |
| bool PathProvider(int key, FilePath* result) { |
| // NOTE: DIR_CURRENT is a special case in PathService::Get |
| if (!PathService::Get(FILE_EXE, result)) |
| *result = result->DirName(); |
| if (!PathService::Get(FILE_MODULE, result)) |
| *result = result->DirName(); |
| return PathService::Get(DIR_MODULE, result); |
| return GetTempDir(result); |
| if (!PathService::Get(DIR_SOURCE_ROOT, &test_data_path)) |
| 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. |
| *result = test_data_path; |