From 251d33933637501b858da5ce0726588fc32834d2 Mon Sep 17 00:00:00 2001 From: Tomasz Iwanek Date: Thu, 25 Feb 2016 10:26:51 +0100 Subject: [PATCH] Adjust moving storage directories - 'shared/' -> 'shared/res/' Requirement changed. We need to copy only 'shared/res/'. To verify install, update, uninstall wgt package that contains files in /shared/res/ and check if they were moved properly to install location's shared/res/. Change-Id: I20b8fcc174423ce74dcba5c9f6c116b1443f452e --- src/wgt/step/step_wgt_patch_storage_directories.cc | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/wgt/step/step_wgt_patch_storage_directories.cc b/src/wgt/step/step_wgt_patch_storage_directories.cc index c6a7a94..e6f976e 100644 --- a/src/wgt/step/step_wgt_patch_storage_directories.cc +++ b/src/wgt/step/step_wgt_patch_storage_directories.cc @@ -16,6 +16,7 @@ namespace bs = boost::system; namespace { const char kSharedLocation[] = "shared"; +const char kSharedResLocation[] = "shared/res"; const char kResWgtSubPath[] = "res/wgt"; const char kTemporaryData[] = "tmp"; @@ -39,8 +40,19 @@ common_installer::Step::Status StepWgtPatchStorageDirectories::process() { } bool StepWgtPatchStorageDirectories::ShareDirFor3x() { - bf::path src = context_->pkg_path.get() / kResWgtSubPath / kSharedLocation; - bf::path dst = context_->pkg_path.get() / kSharedLocation; + bf::path shared_dir = context_->pkg_path.get() / kSharedLocation; + if (!bf::exists(shared_dir)) { + bs::error_code error; + bf::create_directory(shared_dir); + if (error) { + LOG(ERROR) << "Failed to create directory: " << shared_dir; + return false; + } + } + bf::path src = context_->pkg_path.get() / kResWgtSubPath / kSharedResLocation; + if (!bf::exists(src)) + return true; + bf::path dst = context_->pkg_path.get() / kSharedResLocation; if (!common_installer::MoveDir(src, dst, common_installer::FS_MERGE_DIRECTORIES)) { LOG(ERROR) << "Failed to move shared data from res/wgt to shared"; -- 2.7.4