1 // Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
2 // Use of this source code is governed by a apache 2.0 license that can be
3 // found in the LICENSE file.
5 #include "wgt/step/filesystem/step_wgt_resource_directory.h"
7 #include <boost/filesystem/path.hpp>
9 #include <common/utils/file_util.h>
11 namespace bf = boost::filesystem;
12 namespace bs = boost::system;
15 namespace filesystem {
17 common_installer::Step::Status StepWgtResourceDirectory::process() {
18 bf::path temp_path = context_->unpacked_dir_path.get();
20 bf::path resource_path = context_->unpacked_dir_path.get() / "res/wgt";
22 if (!common_installer::MoveDir(context_->unpacked_dir_path.get(),
24 LOG(ERROR) << "Failed to move: " << context_->unpacked_dir_path.get()
25 << " to: " << temp_path;
26 return Status::APP_DIR_ERROR;
29 bf::create_directories(resource_path.parent_path(), error);
31 LOG(ERROR) << "Failed to create proper directory structure in widget";
32 return Status::APP_DIR_ERROR;
34 if (!common_installer::MoveDir(temp_path, resource_path)) {
35 LOG(ERROR) << "Failed to move: " << temp_path << " to: " << resource_path;
36 return Status::APP_DIR_ERROR;
39 LOG(INFO) << "Widget content moved to res/wgt subdirectory";
43 } // namespace filesystem