From: Piotr Ganicz
Date: Mon, 14 Nov 2016 15:35:01 +0000 (+0100)
Subject: Fix StepRecoverExternalStorage
X-Git-Tag: accepted/tizen/3.0/common/20161130.065233~2
X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F01%2F98201%2F5;p=platform%2Fcore%2Fappfw%2Fapp-installers.git
Fix StepRecoverExternalStorage
This patch improves that step to handle situation when manifest
does not exists.
To test:
1. Crash app before StepGenerateXML
2. su app_fw
3. run wgt-backend -b -u 5001
4. Check if you can normally install the same app.
Change-Id: I220157a47e8d7bbeef2710b377e7a70763fac999
---
diff --git a/src/common/step/filesystem/step_recover_external_storage.cc b/src/common/step/filesystem/step_recover_external_storage.cc
index f330335..b106ea3 100644
--- a/src/common/step/filesystem/step_recover_external_storage.cc
+++ b/src/common/step/filesystem/step_recover_external_storage.cc
@@ -4,11 +4,25 @@
#include "common/step/filesystem/step_recover_external_storage.h"
+#include
+#include
+#include
+
+namespace bf = boost::filesystem;
+namespace bs = boost::system;
+
namespace common_installer {
namespace filesystem {
Step::Status StepRecoverExternalStorage::process() {
- (void) StepAcquireExternalStorage::process();
+ if (!context_->manifest_data.get()) {
+ bs::error_code error;
+ if (bf::exists(context_->pkg_path.get())) {
+ bf::remove_all(context_->pkg_path.get(), error);
+ }
+ } else {
+ (void) StepAcquireExternalStorage::process();
+ }
return Status::OK;
}
diff --git a/src/common/step/filesystem/step_recover_external_storage.h b/src/common/step/filesystem/step_recover_external_storage.h
index 68bac1b..71633e4 100644
--- a/src/common/step/filesystem/step_recover_external_storage.h
+++ b/src/common/step/filesystem/step_recover_external_storage.h
@@ -20,6 +20,8 @@ class StepRecoverExternalStorage : public StepAcquireExternalStorage {
public:
using StepAcquireExternalStorage::StepAcquireExternalStorage;
+ Status precheck() override { return Status::OK; };
+
Status process() override;
STEP_NAME(RecoverExternalStorage)