Remove boost dependency
[platform/core/appfw/app-installers.git] / src / common / step / rds / step_rds_parse.cc
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.
4
5 #include "common/step/rds/step_rds_parse.h"
6
7 #include <manifest_parser/utils/logging.h>
8
9 #include <memory>
10
11 #include "common/installer_context.h"
12 #include "common/rds_parser.h"
13
14 namespace common_installer {
15 namespace rds {
16
17 namespace fs = std::filesystem;
18
19 Step::Status StepRDSParse::precheck() {
20   fs::path rdsPath(context_->unpacked_dir_path.get() / ".rds_delta");
21   if (!fs::exists(rdsPath)) {
22     LOG(ERROR) << "no rds_delta file";
23     return Step::Status::INVALID_VALUE;
24   }
25   rds_file_path_ = rdsPath;
26   return Step::Status::OK;
27 }
28
29 Step::Status StepRDSParse::process() {
30   RDSParser parser(rds_file_path_.native());
31   if (!parser.Parse()) {
32     LOG(ERROR) << "parsing of rds delta failed";
33     return Step::Status::PARSE_ERROR;
34   }
35
36   context_->files_to_modify.set(parser.files_to_modify());
37   context_->files_to_add.set(parser.files_to_add());
38   context_->files_to_delete.set(parser.files_to_delete());
39   return Step::Status::OK;
40 }
41
42 }  // namespace rds
43 }  // namespace common_installer