1 // Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
2 // Use of this source code is governed by an apache 2.0 license that can be
3 // found in the LICENSE file.
5 #include "theme_plugin/theme_info_builder.h"
7 #include <boost/filesystem.hpp>
12 #include "theme/utils/logging.h"
14 namespace bf = boost::filesystem;
18 const char kThemeFilesPrefix[] = "/theme/files/";
25 ThemeInfoBuilder::ThemeInfoBuilder(const std::string& id) {
26 bundle_.Add("id", id);
29 ThemeInfoBuilder& ThemeInfoBuilder::PutString(const std::string& key,
30 const std::string& value) {
31 bundle_.Add(key, value);
35 ThemeInfoBuilder& ThemeInfoBuilder::PutStringArray(const std::string& key,
36 const std::vector<std::string>& value) {
37 bundle_.Add(key, value);
41 loader::ThemeInfo ThemeInfoBuilder::Build() {
42 return loader::ThemeInfo(bundle_);
45 void ThemeInfoBuilder::GenerateFileKey(const std::string& root) {
46 for (bf::recursive_directory_iterator it(root);
47 it != bf::recursive_directory_iterator(); ++it) {
48 if (!bf::is_directory(it->path()))
51 std::string filepath = it->path().string().substr(root.size());
52 std::string key = kThemeFilesPrefix + filepath;
53 std::string val = "shared/res/" + filepath;
54 bundle_.Add(key, val);