Add codes at StepRemoveFiles to remove RO data properly 44/102744/5
authorJunghyun Yeon <jungh.yeon@samsung.com>
Tue, 6 Dec 2016 11:06:21 +0000 (20:06 +0900)
committerjongmyeong ko <jongmyeong.ko@samsung.com>
Thu, 8 Dec 2016 12:40:46 +0000 (04:40 -0800)
- when tried to uninstall preload-rw package but keep
rwdata, RO directory should be removed

Related changes:
[wgt-backend] : https://review.tizen.org/gerrit/102026

Change-Id: I4f42eac12b6b1d69aedee2627a32f7fc4b1e55d9
Signed-off-by: Junghyun Yeon <jungh.yeon@samsung.com>
src/common/step/filesystem/step_remove_files.cc

index 8274995..0a157bf 100644 (file)
@@ -27,7 +27,9 @@ bool SkipRWDirectories(const bf::path& path) {
   static const std::vector<std::string> dirs_to_ignore = {
     {"cache"},
     {"data"},
-    {"shared"},
+    {"shared/data"},
+    {"shared/cache"},
+    {"shared/trusted"},
   };
   return std::find(dirs_to_ignore.begin(), dirs_to_ignore.end(), path) !=
       dirs_to_ignore.end();
@@ -82,6 +84,14 @@ Step::Status StepRemoveFiles::process() {
       if (error)
         LOG(ERROR) << "Can't remove path:" << itr->path().c_str();
     }
+
+    if (context_->keep_rwdata.get()) {
+      bf::remove_all(pkg_path, error);
+      if (error)
+        LOG(ERROR) << "Can't remove directory:" <<
+            context_->pkg_path.get().c_str();
+    }
+
   } else {
     bf::remove_all(pkg_path, error);
     if (error)