#include <tpk/step/filesystem/step_create_tpk_symbolic_link.h>
#include <tpk/step/filesystem/step_tpk_patch_icons.h>
#include <tpk/step/filesystem/step_tpk_prepare_package_directory.h>
-#include <tpk/step/filesystem/step_tpk_update_package_directory.h>
#include <tpk/step/pkgmgr/step_manifest_adjustment.h>
#include <tpk/step/security/step_tpk_recover_signature.h>
"CheckWgtNotificationCategory");
AddStepAfter<hybrid::encryption::StepEncryptHybridResources>(
"CheckWgtImePrivilege");
- AddStepAfter<tpk::filesystem::StepTpkUpdatePackageDirectory>("MountUpdate");
+ AddStepAfter<tpk::filesystem::StepTpkPreparePackageDirectory>("MountUpdate");
AddStepAfter<tpk::filesystem::StepTpkPatchIcons>("CreateIcons");
AddStepAfter<wgt::filesystem::StepWgtPatchIcons>("TpkPatchIcons", true);
AddStepAfter<wgt::filesystem::StepCopyPreviewIcons>("WgtPatchIcons");
}
for (auto& entry : GetExtractEntries()) {
- if (context_->request_type.get() == ci::RequestType::MountInstall) {
- ci::RemoveAll(resource_path / entry);
- } else if (context_->request_type.get() == ci::RequestType::MountUpdate) {
- if (!ci::BackupDir(resource_path, backup_path, entry))
- return Status::APP_DIR_ERROR;
- }
-
+ ci::RemoveAll(resource_path / entry);
if (!ci::ExtractToTmpDir(context_->file_path.get().c_str(),
resource_path.c_str(), entry)) {
LOG(ERROR) << "Failed to extract file";
#include <common/utils/paths.h>
#include <common/utils/file_util.h>
+#include <string>
+#include <vector>
+
namespace bf = boost::filesystem;
namespace bs = boost::system;
namespace ci = common_installer;
namespace {
-const char* kBackupEntries[] = {
+
+const std::vector<std::string> kBackupEntries = {
"bin",
- "shared/res"
+ "shared/res",
+ "res/wgt"
};
bool MoveCreateDir(const bf::path& source, const bf::path& destination) {
- if (!bf::exists(destination.parent_path())) {
- bs::error_code error;
- bf::create_directories(destination.parent_path(), error);
- if (error) {
- LOG(ERROR) << "Cannot create directory: " << destination.parent_path();
- return false;
- }
- }
if (!ci::MoveDir(source, destination)) {
LOG(ERROR) << "Failed to move directory " << destination;
return false;
bf::path backup_path =
ci::GetBackupPathForPackagePath(context_->GetPkgPath());
for (auto& entry : kBackupEntries) {
- bf::path directory = context_->GetPkgPath() / entry;
+ std::string root_entry = entry.substr(0, entry.find("/"));
+ bf::path directory = context_->GetPkgPath() / root_entry;
if (!bf::exists(directory))
continue;
LOG(DEBUG) << "Backup directory entry: " << entry;
- bf::path directory_backup = backup_path / entry;
+ bf::path directory_backup = backup_path / root_entry;
if (!MoveCreateDir(directory, directory_backup)) {
LOG(ERROR) << "Failed to create backup directory "
<< directory_backup;
return Status::OK;
for (auto& entry : kBackupEntries) {
- bf::path directory = context_->GetPkgPath() / entry;
- bf::path directory_backup = backup_path / entry;
+ std::string root_entry = entry.substr(0, entry.find("/"));
+ bf::path directory = context_->GetPkgPath() / root_entry;
+ bf::path directory_backup = backup_path / root_entry;
if (!bf::exists(directory_backup))
continue;
LOG(DEBUG) << "Recover directory entry: " << entry;