#include "common/step/configuration/step_parse_manifest.h"
-#include <boost/tokenizer.hpp>
-
#include <pkgmgr/pkgmgr_parser.h>
#include <pkgmgr-info.h>
#include <cstdio>
#include <cstdlib>
#include <cstring>
+#include <filesystem>
#include <memory>
+#include <regex>
#include <set>
#include <type_traits>
#include <string>
#include "common/utils/time_util.h"
namespace app_keys = tpk::application_keys;
-namespace bf = boost::filesystem;
+namespace fs = std::filesystem;
namespace {
}
bool StepParseManifest::LocateConfigFile() {
- boost::filesystem::path manifest;
+ std::filesystem::path manifest;
switch (manifest_location_) {
case ManifestLocation::RECOVERY: {
- bf::path backup_path = common_installer::GetBackupPathForPackagePath(
+ fs::path backup_path = common_installer::GetBackupPathForPackagePath(
context_->GetPkgPath()) / kManifestFileName;
- bf::path in_package_path = context_->GetPkgPath() / kManifestFileName;
- bf::path install_path =
- bf::path(getUserManifestPath(context_->uid.get(),
+ fs::path in_package_path = context_->GetPkgPath() / kManifestFileName;
+ fs::path install_path =
+ fs::path(getUserManifestPath(context_->uid.get(),
context_->is_readonly_package.get()))
- / bf::path(context_->pkgid.get());
+ / fs::path(context_->pkgid.get());
install_path += ".xml";
- bf::path backup_install_path =
+ fs::path backup_install_path =
common_installer::GetBackupPathForManifestFile(install_path);
- if (bf::exists(backup_install_path))
+ if (fs::exists(backup_install_path))
manifest = backup_install_path;
- else if (bf::exists(backup_path))
+ else if (fs::exists(backup_path))
manifest = backup_path;
- else if (bf::exists(install_path))
+ else if (fs::exists(install_path))
manifest = install_path;
- else if (bf::exists(in_package_path))
+ else if (fs::exists(in_package_path))
manifest = in_package_path;
break;
}
uid = tzplatform_getuid(TZ_SYS_GLOBALAPP_USER);
else
uid = context_->uid.get();
- bf::path xml_path =
- bf::path(getUserManifestPath(uid, is_readonly))
- / bf::path(context_->pkgid.get());
+ fs::path xml_path =
+ fs::path(getUserManifestPath(uid, is_readonly))
+ / fs::path(context_->pkgid.get());
xml_path += ".xml";
context_->xml_path.set(xml_path);
manifest = context_->xml_path.get();
- if (!boost::filesystem::exists(manifest)) {
+ if (!std::filesystem::exists(manifest)) {
/* This routine has added for platform update */
manifest = context_->unpacked_dir_path.get();
manifest /= kManifestFileName;
LOG(DEBUG) << "manifest path: " << manifest;
- if (!boost::filesystem::exists(manifest))
+ if (!std::filesystem::exists(manifest))
return false;
path_ = manifest;
privilege->value = strdup(priv.privilege.c_str());
privilege->type = strdup(priv.type.c_str());
if (!priv.license.empty()) {
- if (bf::path(priv.license).is_absolute())
+ if (fs::path(priv.license).is_absolute())
privilege->license = strdup(priv.license.c_str());
else
privilege->license = strdup((context_->GetPkgPath()
privilege->value = strdup(priv.privilege.c_str());
privilege->type = strdup(priv.type.c_str());
if (!priv.license.empty()) {
- if (bf::path(priv.license).is_absolute())
+ if (fs::path(priv.license).is_absolute())
privilege->license = strdup(priv.license.c_str());
else
privilege->license = strdup((context_->GetPkgPath()
else
widget_app->api_version = strdup(manifest->api_version);
manifest->application = g_list_append(manifest->application, widget_app);
- if (bf::path(application.app_info.exec().c_str()).is_absolute())
+ if (fs::path(application.app_info.exec().c_str()).is_absolute())
widget_app->exec = strdup(application.app_info.exec().c_str());
else
widget_app->exec = strdup((context_->root_application_path.get()
else
service_app->api_version = strdup(manifest->api_version);
manifest->application = g_list_append(manifest->application, service_app);
- if (bf::path(application.app_info.exec().c_str()).is_absolute())
+ if (fs::path(application.app_info.exec().c_str()).is_absolute())
service_app->exec = strdup(application.app_info.exec().c_str());
else
service_app->exec = strdup((context_->root_application_path.get()
else
ui_app->api_version = strdup(manifest->api_version);
manifest->application = g_list_append(manifest->application, ui_app);
- if (bf::path(application.app_info.exec().c_str()).is_absolute())
+ if (fs::path(application.app_info.exec().c_str()).is_absolute())
ui_app->exec = strdup(application.app_info.exec().c_str());
else
ui_app->exec = strdup((context_->root_application_path.get()
}
watch_app->appid = strdup(watch_application.app_info.appid().c_str());
- if (bf::path(watch_application.app_info.exec().c_str()).is_absolute())
+ if (fs::path(watch_application.app_info.exec().c_str()).is_absolute())
watch_app->exec = strdup(watch_application.app_info.exec().c_str());
else
watch_app->exec = strdup(
LOG(ERROR) << "Out of memory";
return false;
}
- bf::path text;
- if (bf::path(application_icon.path()).is_absolute()) {
+ fs::path text;
+ if (fs::path(application_icon.path()).is_absolute()) {
text = application_icon.path();
} else {
text = context_->root_application_path.get()
LOG(ERROR) << "Out of memory";
return;
}
- if (bf::path(src).is_absolute()) {
+ if (fs::path(src).is_absolute()) {
splashscreen->src = strdup(src.c_str());
} else {
- bf::path full_path = context_->GetPkgPath() / src;
- splashscreen->src = strdup(full_path.string().c_str());
+ fs::path full_path = context_->GetPkgPath() / src;
+ splashscreen->src = strdup(full_path.c_str());
}
if (src.substr(src.find_last_of(".") + 1) == "edj")
splashscreen->type = strdup("edj");
if (context_->is_readonly_package.get())
src = splash_screen.src();
else
- src = bf::path(context_->root_application_path.get()
+ src = fs::path(context_->root_application_path.get()
/ app->package / "shared" / "res" / splash_screen.src()).string();
AppendSplashScreen(app, src, splash_screen.type(), splash_screen.dpi(),
void StepParseManifest::GetLegacySplashScreenFromMetadata(application_x* app,
const std::string& key, const std::string& val) {
std::string operation;
- if (key.find(kOperationEffectKey) != std::string::npos) {
- boost::char_separator<char> sep("=");
- boost::tokenizer<boost::char_separator<char>> tokens(key, sep);
- auto iter = tokens.begin();
- iter++;
- operation = *iter;
+ auto pos = key.find(kOperationEffectKey);
+ if (pos != std::string::npos) {
+ operation = key.substr(pos + 1, key.size());
} else if (key.find(kLaunchEffectKey) != std::string::npos) {
operation = std::string("launch-effect");
} else {
return;
}
- boost::char_separator<char> sep("=|");
- boost::tokenizer<boost::char_separator<char>> tokens(val, sep);
- auto iter = tokens.begin();
std::string portrait_src;
std::string landscape_src;
std::string indicatordisplay;
- while (iter != tokens.end()) {
- if (!(*iter).compare(kPortraitEffectImageValue)) {
- iter++;
- portrait_src = *iter;
- } else if (!(*iter).compare(kLandscapeEffectImageValue)) {
- iter++;
- landscape_src = *iter;
- } else if (!(*iter).compare(kIndicatorDisplayValue)) {
- iter++;
- indicatordisplay = *iter;
- }
- iter++;
+
+ std::regex re("[=|]");
+ std::sregex_token_iterator first(val.begin(), val.end(), re, -1);
+ std::sregex_token_iterator last;
+ std::vector<std::string> tokens(first, last);
+ for (const auto t : tokens) {
+ if (t.compare(kPortraitEffectImageValue))
+ portrait_src = t;
+ else if (t.compare(kLandscapeEffectImageValue))
+ landscape_src = t;
+ else if (t.compare(kIndicatorDisplayValue))
+ indicatordisplay = t;
}
+
if (!portrait_src.empty())
AppendSplashScreen(app, portrait_src, {}, {}, kPortraitOrientation,
indicatordisplay, operation, {});
app->splash_screen_display =
strdup(application.app_info.splash_screen_display().c_str());
manifest->application = g_list_append(manifest->application, app);
- if (bf::path(application.app_info.exec().c_str()).is_absolute()) {
+ if (fs::path(application.app_info.exec().c_str()).is_absolute()) {
app->exec = strdup(application.app_info.exec().c_str());
} else {
app->exec = strdup((context_->root_application_path.get()
if (!parser_->ParseManifest(path_)) {
if (manifest_location_ == ManifestLocation::RECOVERY) {
LOG(DEBUG) << "Manifest for recovery is invalid";
- bf::remove(path_);
+ fs::remove(path_);
return Step::Status::OK;
}
LOG(ERROR) << "[Parse] Parse failed. " << parser_->GetErrorMessage();