blob: ce726848dcce57d4a9beae6af1dac39bdc6392db (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
// Copyright 2014 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 "chromecast/base/cast_paths.h"
#include "base/base_paths.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/logging.h"
#include "base/path_service.h"
#include "build/build_config.h"
namespace chromecast {
bool PathProvider(int key, base::FilePath* result) {
switch (key) {
case DIR_CAST_HOME: {
base::FilePath home = base::GetHomeDir();
#if defined(ARCH_CPU_ARMEL)
// When running on the actual device, $HOME is set to the user's
// directory under the data partition.
*result = home;
#else
// When running a development instance as a regular user, use
// a data directory under $HOME (similar to Chrome).
*result = home.Append(".config/cast_shell");
#endif
return true;
}
#if defined(OS_ANDROID)
case FILE_CAST_ANDROID_LOG: {
base::FilePath base_dir;
CHECK(PathService::Get(base::DIR_ANDROID_APP_DATA, &base_dir));
*result = base_dir.AppendASCII("cast_shell.log");
return true;
}
#endif // defined(OS_ANDROID)
case FILE_CAST_CONFIG: {
base::FilePath data_dir;
#if defined(OS_ANDROID)
CHECK(PathService::Get(base::DIR_ANDROID_APP_DATA, &data_dir));
*result = data_dir.Append("cast_shell.conf");
#else
CHECK(PathService::Get(DIR_CAST_HOME, &data_dir));
*result = data_dir.Append(".eureka.conf");
#endif // defined(OS_ANDROID)
return true;
}
case FILE_CAST_PAK: {
base::FilePath base_dir;
#if defined(OS_ANDROID)
CHECK(PathService::Get(base::DIR_ANDROID_APP_DATA, &base_dir));
*result = base_dir.Append("paks/cast_shell.pak");
#else
CHECK(PathService::Get(base::DIR_MODULE, &base_dir));
*result = base_dir.Append("assets/cast_shell.pak");
#endif // defined(OS_ANDROID)
return true;
}
}
return false;
}
void RegisterPathProvider() {
PathService::RegisterProvider(PathProvider, PATH_START, PATH_END);
}
} // namespace chromecast
|