1 // Copyright 2014 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 "chromecast/common/cast_paths.h"
7 #include "base/base_paths.h"
8 #include "base/file_util.h"
9 #include "base/files/file_path.h"
10 #include "base/path_service.h"
11 #include "build/build_config.h"
13 namespace chromecast
{
15 bool PathProvider(int key
, base::FilePath
* result
) {
18 base::FilePath home
= base::GetHomeDir();
19 #if defined(ARCH_CPU_ARMEL)
20 // When running on the actual device, $HOME is set to the user's
21 // directory under the data partition.
24 // When running a development instance as a regular user, use
25 // a data directory under $HOME (similar to Chrome).
26 *result
= home
.Append(".config/cast_shell");
30 case FILE_CAST_CONFIG
: {
31 base::FilePath data_dir
;
32 #if defined(OS_ANDROID)
33 CHECK(PathService::Get(base::DIR_ANDROID_APP_DATA
, &data_dir
);
34 *result
= data_dir
.Append("cast_shell.conf");
36 CHECK(PathService::Get(DIR_CAST_HOME
, &data_dir
));
37 *result
= data_dir
.Append(".eureka.conf");
38 #endif // defined(OS_ANDROID)
42 base::FilePath base_dir
;
43 #if defined(OS_ANDROID)
44 CHECK(PathService::Get(base::DIR_ANDROID_APP_DATA
, &base_dir
));
45 *result
= base_dir
.Append("paks/cast_shell.pak");
47 CHECK(PathService::Get(base::DIR_MODULE
, &base_dir
));
48 *result
= base_dir
.Append("assets/cast_shell.pak");
49 #endif // defined(OS_ANDROID)
56 void RegisterPathProvider() {
57 PathService::RegisterProvider(PathProvider
, PATH_START
, PATH_END
);
60 } // namespace chromecast