1 // Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
2 // Use of this source code is governed by an apache 2.0 license that can be
3 // found in the LICENSE file.
5 #include "wgt/step/configuration/step_check_rds_manifest.h"
7 #include <boost/filesystem/operations.hpp>
8 #include <boost/filesystem/path.hpp>
9 #include <boost/system/error_code.hpp>
11 namespace bf = boost::filesystem;
12 namespace bs = boost::system;
16 const char kConfigInstalled[] = "res/wgt/config.xml";
17 const char kConfigDeltaDir[] = "res/wgt/config.xml";
22 namespace configuration {
24 common_installer::Step::Status StepCheckRDSManifest::process() {
25 bf::path target = context_->unpacked_dir_path.get() / kConfigDeltaDir;
26 if (!bf::exists(target)) {
27 bf::path source = context_->root_application_path.get() /
28 context_->pkgid.get() / kConfigInstalled;
29 if (!bf::exists(source)) {
30 LOG(ERROR) << "Cannot find old manifest file";
31 return Status::APP_DIR_ERROR;
34 bf::create_directories(source.parent_path(), error);
36 LOG(ERROR) << "Failed to create directories for manifest file";
37 return Status::APP_DIR_ERROR;
39 bf::copy_file(source, target, error);
41 LOG(ERROR) << "Failed to copy old manifest file";
42 return Status::APP_DIR_ERROR;
48 } // namespace configuration