pkg_path is always equal to root_application_path + pkgid.
Storing this information in separate variable is problematic,
because it requires to remember to update pkg_path after
root_application_path or pkgid is changed.
Submit with:
- https://review.tizen.org/gerrit/#/c/154196/
- https://review.tizen.org/gerrit/#/c/160353/
Change-Id: I3a1a3ddccb041e93f2aa633b19174f1c67a4ff96
Signed-off-by: Damian Pietruchowski <d.pietruchow@samsung.com>
ci::Step::Status StepGenerateXml::process() {
bf::path wgt_xml_path = context_->xml_path.get();
- bf::path tpk_xml_path = context_->pkg_path.get() / "tizen-manifest.xml";
+ bf::path tpk_xml_path = context_->GetPkgPath() / "tizen-manifest.xml";
if (!LoadXmlDocument(wgt_xml_path, tpk_xml_path))
return Step::Status::MANIFEST_ERROR;
return Step::Status::MANIFEST_ERROR;
}
- bf::path tpk_xml_path = context_->pkg_path.get() / "tizen-manifest.xml";
+ bf::path tpk_xml_path = context_->GetPkgPath() / "tizen-manifest.xml";
if (!bf::exists(tpk_xml_path)) {
LOG(ERROR) << "Native manifest file not found: " << tpk_xml_path;
return Step::Status::MANIFEST_ERROR;
case ConfigLocation::PACKAGE:
return StepParse::Check(context_->unpacked_dir_path.get());
case ConfigLocation::INSTALLED:
- return StepParse::Check(context_->pkg_path.get() / kResWgt);
+ return StepParse::Check(context_->GetPkgPath() / kResWgt);
case ConfigLocation::RECOVERY:
if (StepParse::Check(common_installer::GetBackupPathForPackagePath(
- context_->root_application_path.get()
- / context_->pkgid.get()) / kResWgt))
+ context_->GetPkgPath()) / kResWgt))
return true;
- if (StepParse::Check(
- context_->root_application_path.get()
- / context_->pkgid.get() / kResWgt))
+ if (StepParse::Check(context_->GetPkgPath() / kResWgt))
return true;
return false;
case ConfigLocation::RESOURCE_WGT:
common_installer::Step::Status StepParseRecovery::process() {
(void) StepParse::process();
- context_->pkg_path.set(
- context_->root_application_path.get() / context_->pkgid.get());
return Status::OK;
}
for (auto& size : appwidget.content_size) {
if (!size.preview.empty()) {
bf::path icon_path =
- context_->pkg_path.get() / kResWgt / size.preview;
+ context_->GetPkgPath() / kResWgt / size.preview;
std::string type = wgt::parse::AppWidgetSizeTypeToString(size.type);
std::string icon_name = appwidget.id + "." + type + "." + "preview" +
bf::path(size.preview).extension().string();
bf::path preview_icon =
- context_->pkg_path.get() / kSharedRes / icon_name;
+ context_->GetPkgPath() / kSharedRes / icon_name;
if (!ci::CopyFile(icon_path, preview_icon)) {
LOG(ERROR) << "Cannot create preview icon: " << preview_icon;
return Status::ICON_ERROR;
if (strcmp("webapp", app->type) != 0)
continue;
// binary is a symbolic link named <appid> and is located in <pkgid>/<appid>
- bf::path exec_path = context_->pkg_path.get() / bf::path("bin");
+ bf::path exec_path = context_->GetPkgPath() / bf::path("bin");
common_installer::CreateDir(exec_path);
exec_path /= bf::path(app->appid);
common_installer::Step::Status StepCreateSymbolicLink::undo() {
for (application_x* app :
GListRange<application_x*>(context_->manifest_data.get()->application)) {
- bf::path exec_path = context_->pkg_path.get() / "bin" / app->appid;
+ bf::path exec_path = context_->GetPkgPath() / "bin" / app->appid;
common_installer::RemoveAll(exec_path);
}
return Status::OK;
namespace filesystem {
common_installer::Step::Status StepWgtPatchIcons::process() {
- bf::path common_icon_location = context_->pkg_path.get() / "shared" / "res";
+ bf::path common_icon_location = context_->GetPkgPath() / "shared" / "res";
bs::error_code error;
bf::create_directories(common_icon_location, error);
if (error) {
if (version >= 3) {
LOG(DEBUG) <<
"Moving and linking widget's shared/res directory content in "
- << context_->pkg_path.get();
+ << context_->GetPkgPath();
if (!ShareDirFor3x())
return Status::APP_DIR_ERROR;
}
bool StepWgtPatchStorageDirectories::ShareDirFor3x() {
// check if ${pkg_path}/res/wgt/shared/res exists
bf::path wgt_shared_res_dir =
- context_->pkg_path.get() / kResWgtSubPath / kSharedResLocation;
+ context_->GetPkgPath() / kResWgtSubPath / kSharedResLocation;
if (!bf::exists(wgt_shared_res_dir))
return true;
// create ${pkg_path}/shared/res
- bf::path shared_dir = context_->pkg_path.get() / kSharedLocation;
+ bf::path shared_dir = context_->GetPkgPath() / kSharedLocation;
if (!bf::exists(shared_dir)) {
bs::error_code error;
bf::create_directory(shared_dir, error);
return false;
}
}
- bf::path shared_res_dir = context_->pkg_path.get() / kSharedResLocation;
+ bf::path shared_res_dir = context_->GetPkgPath() / kSharedResLocation;
if (!bf::exists(shared_res_dir)) {
bs::error_code error;
bf::create_directory(shared_res_dir, error);
}
bool StepWgtPatchStorageDirectories::CreatePrivateTmpDir() {
- bf::path tmp_path = context_->pkg_path.get() / kTemporaryData;
+ bf::path tmp_path = context_->GetPkgPath() / kTemporaryData;
if (bf::exists(tmp_path) && bf::is_directory(tmp_path)) {
return true;
}
ci::Step::Status StepWgtPreparePackageDirectory::CreateSymlinkToMountPoint() {
bs::error_code error;
- bf::path mount_point = ci::GetMountLocation(context_->pkg_path.get());
- bf::path res_wgt_link = context_->pkg_path.get() / kResWgtDirectory;
+ bf::path mount_point = ci::GetMountLocation(context_->GetPkgPath());
+ bf::path res_wgt_link = context_->GetPkgPath() / kResWgtDirectory;
if (bf::exists(res_wgt_link)) {
if (!bf::is_symlink(symlink_status(res_wgt_link))) {
LOG(ERROR) << res_wgt_link << " is not symlink. Cannot proceed";
}
ci::Step::Status StepWgtPreparePackageDirectory::precheck() {
- if (context_->pkg_path.get().empty()) {
+ if (context_->GetPkgPath().empty()) {
LOG(ERROR) << "Package installation path is not set";
return Status::INVALID_VALUE;
}
if (version >= 3) {
LOG(DEBUG) <<
"Unlinking and moving widget's shared/res directory content back in "
- << context_->pkg_path.get();
+ << context_->GetPkgPath();
if (!UndoShareDirFor3x())
return Status::APP_DIR_ERROR;
}
LOG(DEBUG) << "Restore res/wgt/shared/res from backup dir";
// restore link
bf::path wgt_shared_res_dir =
- context_->pkg_path.get() / kResWgtSubPath / kSharedResLocation;
+ context_->GetPkgPath() / kResWgtSubPath / kSharedResLocation;
bf::path backup_wgt_shared_res = backup_dir_ / "wgt_shared_res";
if (!backup_wgt_shared_res.empty()) {
if (!ci::RemoveAll(wgt_shared_res_dir)) {
}
}
// restore original contents
- bf::path shared_res_dir = context_->pkg_path.get() / kSharedResLocation;
+ bf::path shared_res_dir = context_->GetPkgPath() / kSharedResLocation;
bf::path backup_shared_res = backup_dir_ / "shared_res";
if (!backup_shared_res.empty()) {
if (!ci::CopyDir(backup_dir_, shared_res_dir,
bool StepWgtUndoPatchStorageDirectories::UndoShareDirFor3x() {
// check if ${pkg_path}/shared/res exists
- bf::path shared_res_dir = context_->pkg_path.get() / kSharedResLocation;
+ bf::path shared_res_dir = context_->GetPkgPath() / kSharedResLocation;
if (!bf::exists(shared_res_dir))
return true;
bf::path wgt_shared_res_dir =
- context_->pkg_path.get() / kResWgtSubPath / kSharedResLocation;
+ context_->GetPkgPath() / kResWgtSubPath / kSharedResLocation;
if (!bf::exists(wgt_shared_res_dir))
return true;
ci::Step::Status
StepWgtUpdatePackageDirectory::CreateBackupOfDirectories() {
bf::path backup_path =
- ci::GetBackupPathForPackagePath(context_->pkg_path.get());
+ ci::GetBackupPathForPackagePath(context_->GetPkgPath());
for (auto& entry : kBackupEntries) {
- bf::path directory = context_->pkg_path.get() / entry;
+ bf::path directory = context_->GetPkgPath() / entry;
if (!bf::exists(directory))
continue;
LOG(DEBUG) << "Backup directory entry: " << entry;
ci::Step::Status
StepWgtUpdatePackageDirectory::RecoverBackupOfDirectories() {
bf::path backup_path =
- ci::GetBackupPathForPackagePath(context_->pkg_path.get());
+ ci::GetBackupPathForPackagePath(context_->GetPkgPath());
// skip if there is no backup of directories
if (!bf::exists(backup_path))
return Status::OK;
for (auto& entry : kBackupEntries) {
- bf::path directory = context_->pkg_path.get() / entry;
+ bf::path directory = context_->GetPkgPath() / entry;
bf::path directory_backup = backup_path / entry;
if (!bf::exists(directory_backup))
continue;
ci::Step::Status StepWgtUpdatePackageDirectory::clean() {
bf::path backup_path =
- ci::GetBackupPathForPackagePath(context_->pkg_path.get());
+ ci::GetBackupPathForPackagePath(context_->GetPkgPath());
if (bf::exists(backup_path)) {
bs::error_code error;
bf::remove_all(backup_path, error);
if (status != Status::OK)
return status;
bf::path backup_path =
- ci::GetBackupPathForPackagePath(context_->pkg_path.get());
+ ci::GetBackupPathForPackagePath(context_->GetPkgPath());
if (bf::exists(backup_path)) {
bs::error_code error;
bf::remove_all(backup_path, error);
xmlTextWriterWriteAttribute(writer, BAD_CAST "appid", BAD_CAST app->appid);
// binary is a symbolic link named <appid> and is located in <pkgid>/<appid>
- bf::path exec_path = context_->pkg_path.get()
+ bf::path exec_path = context_->GetPkgPath()
/ bf::path("bin") / bf::path(app->appid);
xmlTextWriterWriteAttribute(writer, BAD_CAST "exec",
BAD_CAST exec_path.string().c_str());
if (!WriteWidgetApplicationAttributesAndElements(writer, app,
static_cast<WgtBackendData*>(
context_->backend_data.get())->appwidgets.get(),
- context_->pkg_path.get() / "shared" / "res"))
+ context_->GetPkgPath() / "shared" / "res"))
return Status::MANIFEST_ERROR;
break;
case AppCompType::WATCHAPP:
}
std::string StepCheckExtensionPrivileges::GetExtensionPath() {
- std::string app_ext_config_pattern(context_->pkg_path.get().string());
+ std::string app_ext_config_pattern(context_->GetPkgPath().string());
app_ext_config_pattern.append(kPluginsDirectory);
struct utsname u;
if (0 == uname(&u)) {
namespace security {
bf::path StepWgtRecoverSignature::GetSignatureRoot() {
- return context_->pkg_path.get() / kResWgt;
+ return context_->GetPkgPath() / kResWgt;
}
} // namespace security