Cleanup - GetBackupPathForPackagePath 06/41806/2
authorTomasz Iwanek <t.iwanek@samsung.com>
Fri, 29 May 2015 13:50:42 +0000 (15:50 +0200)
committerPawel Sikorski <p.sikorski@samsung.com>
Thu, 18 Jun 2015 08:38:49 +0000 (01:38 -0700)
Backup directory in update installation is created per package
not per application (becuase we just copy whole content).

There should be one place which defines how this path is constructed.

Change-Id: I694d4641088acbeccd0cdab04d9e510b16415bf1

src/common/context_installer.cc
src/common/context_installer.h
src/common/step/step_copy_backup.cc
src/common/step/step_copy_storage_directories.cc

index 6e9d434..7007083 100644 (file)
@@ -26,4 +26,11 @@ ContextInstaller::~ContextInstaller() {
     delete backend_data.get();
 }
 
+boost::filesystem::path GetBackupPathForPackagePath(
+    const boost::filesystem::path& pkg_path) {
+  fs::path backup_path = pkg_path;
+  backup_path += ".bck";
+  return backup_path;
+}
+
 }  // namespace common_installer
index b11b483..ae01c48 100644 (file)
@@ -83,6 +83,9 @@ class ContextInstaller {
   Property<BackendData*> backend_data;
 };
 
+boost::filesystem::path GetBackupPathForPackagePath(
+    const boost::filesystem::path& pkg_path);
+
 }  // namespace common_installer
 
 #endif  // COMMON_CONTEXT_INSTALLER_H_
index fb3b71a..62777b9 100644 (file)
@@ -37,8 +37,7 @@ Step::Status StepCopyBackup::process() {
       !m->uiapplication))
     install_path_ /= bf::path(context_->manifest_data.get()->mainapp_id);
 
-  backup_path_ = context_->pkg_path.get();
-  backup_path_ += ".bck";
+  backup_path_ = GetBackupPathForPackagePath(context_->pkg_path.get());
 
   // backup old content
   if (!utils::MoveDir(context_->pkg_path.get(), backup_path_)) {
index 50fa4ff..a2817b6 100644 (file)
@@ -20,8 +20,8 @@ const char kDataLocation[] = "data";
 const char kSharedLocation[] = "shared";
 
 bool RestoreApplicationStorageForData(const bf::path& pkg_path) {
-  bf::path backup_path = pkg_path;
-  backup_path += ".bck";
+  bf::path backup_path =
+      common_installer::GetBackupPathForPackagePath(pkg_path);
 
   bs::error_code error_code;
   if (!bf::exists(backup_path, error_code)) {