summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlho Kim <ilho159.kim@samsung.com>2024-09-05 09:41:57 +0900
committerIlho Kim <ilho159.kim@samsung.com>2024-09-25 17:07:22 +0900
commita981b689664d2394736f8214e7fd47e3a935f893 (patch)
treef5542e9dc367344c274de640ab4f42369f561225
parent344a61d3e4f0cf0fabf0fd113a8641ddb0e061bc (diff)
downloadapp-installers-a981b689664d2394736f8214e7fd47e3a935f893.tar.gz
app-installers-a981b689664d2394736f8214e7fd47e3a935f893.tar.bz2
app-installers-a981b689664d2394736f8214e7fd47e3a935f893.zip
Remove already exist path during StepCopy
If StepCopy is performed while the installation path remains, the file of the package to be installed is not installed Change-Id: I2be44c762c8b965f99ada6f03cd9c36cce43af85 Signed-off-by: Ilho Kim <ilho159.kim@samsung.com>
-rw-r--r--src/common/step/filesystem/step_copy.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/common/step/filesystem/step_copy.cc b/src/common/step/filesystem/step_copy.cc
index 9e92a4ed..c3c317ae 100644
--- a/src/common/step/filesystem/step_copy.cc
+++ b/src/common/step/filesystem/step_copy.cc
@@ -74,6 +74,17 @@ Step::Status StepCopy::process() {
<< install_path.parent_path().string();
return Step::Status::APP_DIR_ERROR;
}
+
+ if (fs::exists(install_path)) {
+ LOG(DEBUG) << "Install path [" << install_path
+ << "] is already exists, try to remove install path";
+ if (!RemoveAll(install_path)) {
+ LOG(ERROR) << "Failed to remove the already existing install path["
+ << install_path << "]";
+ return Step::Status::APP_DIR_ERROR;
+ }
+ }
+
if (!MoveDir(context_->unpacked_dir_path.get(), install_path,
FSFlag::FS_MERGE_SKIP)) {
LOG(ERROR) << "Cannot move widget directory to install path, from "