X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fcommon%2Fstep%2Fmount%2Fstep_mount_update.cc;h=fcba92d4a595683491eeafe0327d42e7e8743dbb;hb=a8c90f5debe53f069cbdea65994cc61bf718bad5;hp=b21d4dd0c768f34dfb07fd0b9b7059cb4e5f4805;hpb=c541d8d73edcbee2556471cdf54cb79474b071d1;p=platform%2Fcore%2Fappfw%2Fapp-installers.git diff --git a/src/common/step/mount/step_mount_update.cc b/src/common/step/mount/step_mount_update.cc index b21d4dd..fcba92d 100644 --- a/src/common/step/mount/step_mount_update.cc +++ b/src/common/step/mount/step_mount_update.cc @@ -24,6 +24,16 @@ namespace common_installer { namespace mount { Step::Status StepMountUpdate::process() { + bs::error_code error; + + if (!bf::exists(backup_path_)) { + bf::create_directories(backup_path_, error); + if (error) { + LOG(ERROR) << "Failed to create backup directory: " << backup_path_; + return Status::APP_DIR_ERROR; + } + } + auto zip_unpack = CreateZipInterface(context_->unpacked_dir_path.get()); if (!zip_unpack->UnmountZip()) { LOG(ERROR) << "Failed to unmount zip package from temporary path"; @@ -74,6 +84,9 @@ Step::Status StepMountUpdate::clean() { context_->GetPkgPath(), context_->pkgid.get())); Remove(backup_zip_location); + if (bf::exists(backup_path_)) + RemoveAll(backup_path_); + return Status::OK; } @@ -103,6 +116,10 @@ Step::Status StepMountUpdate::undo() { return Status::APP_DIR_ERROR; } } + + if (bf::exists(backup_path_)) + RemoveAll(backup_path_); + return Status::OK; } @@ -134,6 +151,8 @@ Step::Status StepMountUpdate::precheck() { return Step::Status::PACKAGE_NOT_FOUND; } + backup_path_ = GetBackupPathForPackagePath(context_->GetPkgPath()); + return Step::Status::OK; }