Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 "chromecast/common/cast_paths.h" | 5 #include "chromecast/common/cast_paths.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| 11 | 11 |
| 12 namespace chromecast { | 12 namespace chromecast { |
| 13 | 13 |
| 14 bool PathProvider(int key, base::FilePath* result) { | 14 bool PathProvider(int key, base::FilePath* result) { |
| 15 switch (key) { | 15 switch (key) { |
| 16 case DIR_CAST_HOME: { | 16 case DIR_CAST_HOME: { |
| 17 base::FilePath home = base::GetHomeDir(); | 17 base::FilePath home = base::GetHomeDir(); |
| 18 #if defined(ARCH_CPU_ARMEL) | 18 #if defined(ARCH_CPU_ARMEL) |
| 19 // When running on the actual device, $HOME is set to the user's | 19 // When running on the actual device, $HOME is set to the user's |
| 20 // directory under the data partition. | 20 // directory under the data partition. |
| 21 *result = home; | 21 *result = home; |
| 22 #else | 22 #else |
| 23 // When running a development instance as a regular user, use | 23 // When running a development instance as a regular user, use |
| 24 // a data directory under $HOME (similar to Chrome). | 24 // a data directory under $HOME (similar to Chrome). |
| 25 *result = home.Append(".config/cast_shell"); | 25 *result = home.Append(".config/cast_shell"); |
| 26 #endif | 26 #endif |
| 27 return true; | 27 return true; |
| 28 } | 28 } |
| 29 case FILE_CAST_CONFIG: { | |
| 30 base::FilePath data_dir; | |
| 31 #if defined(OS_ANDROID) | |
| 32 CHECK(PathService::Get(base::DIR_ANDROID_APP_DATA, &data_dir); | |
| 33 *result = data_dir.Append(".eureka.conf"); | |
|
lcwu1
2014/08/08 00:22:38
Why not name the config file the same as Chromecas
gunsch
2014/08/08 00:26:36
Whoa, this is backwards. Thanks for catching. It w
| |
| 34 #else | |
| 35 CHECK(PathService::Get(DIR_CAST_HOME, &data_dir)); | |
| 36 *result = data_dir.Append("cast_shell.conf"); | |
| 37 #endif // defined(OS_ANDROID) | |
| 38 return true; | |
| 39 } | |
| 29 } | 40 } |
| 30 return false; | 41 return false; |
| 31 } | 42 } |
| 32 | 43 |
| 33 void RegisterPathProvider() { | 44 void RegisterPathProvider() { |
| 34 PathService::RegisterProvider(PathProvider, PATH_START, PATH_END); | 45 PathService::RegisterProvider(PathProvider, PATH_START, PATH_END); |
| 35 } | 46 } |
| 36 | 47 |
| 37 } // namespace chromecast | 48 } // namespace chromecast |
| OLD | NEW |