Chromium Code Reviews| Index: chromecast/common/cast_paths.cc |
| diff --git a/chromecast/common/cast_paths.cc b/chromecast/common/cast_paths.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..48344809a2a8167c2b07f7af5d08fead848947b3 |
| --- /dev/null |
| +++ b/chromecast/common/cast_paths.cc |
| @@ -0,0 +1,38 @@ |
| +// Copyright (c) 2014 Google Inc. All Rights Reserved. |
|
jam
2014/04/04 01:01:24
btw in this and other files, no "(c)"
lcwu1
2014/04/22 00:59:40
Done.
|
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "chromecast/common/cast_paths.h" |
| + |
| +#include "base/file_util.h" |
| +#include "base/files/file_path.h" |
| +#include "base/path_service.h" |
| + |
| +namespace chromecast { |
| + |
| +bool PathProvider(int key, base::FilePath* result) { |
| + switch (key) { |
| + case DIR_CAST_HOME: { |
| + base::FilePath home = base::GetHomeDir(); |
| +#if defined(__arm__) |
| + // When running on the actual device, our data directory is |
| + // $HOME for the chrome user. |
| + *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; |
| + } |
| + } |
| + return false; |
| +} |
| + |
| +// This cannot be done as a static initializer sadly since Visual Studio will |
| +// eliminate this object file if there is no direct entry point into it. |
|
jam
2014/04/04 01:01:24
no need to copy this comment
lcwu1
2014/04/22 00:59:40
Done.
|
| +void RegisterPathProvider() { |
| + PathService::RegisterProvider(PathProvider, PATH_START, PATH_END); |
| +} |
| + |
| +} // namespace chromecast |