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
3 // found in the LICENSE file.
5 #include "base/base_paths.h"
7 #include "base/files/file_path.h"
8 #include "base/files/file_util.h"
9 #include "base/path_service.h"
13 bool PathProvider(int key, FilePath* result) {
14 // NOTE: DIR_CURRENT is a special case in PathService::Get
18 if (!PathService::Get(FILE_EXE, result))
20 *result = result->DirName();
23 if (!PathService::Get(FILE_MODULE, result))
25 *result = result->DirName();
28 return PathService::Get(DIR_MODULE, result);
30 return GetTempDir(result);
32 *result = GetHomeDir();
35 FilePath test_data_path;
36 if (!PathService::Get(DIR_SOURCE_ROOT, &test_data_path))
38 test_data_path = test_data_path.Append(FILE_PATH_LITERAL("base"));
39 test_data_path = test_data_path.Append(FILE_PATH_LITERAL("test"));
40 test_data_path = test_data_path.Append(FILE_PATH_LITERAL("data"));
41 if (!PathExists(test_data_path)) // We don't want to create this.
43 *result = test_data_path;