Fix codes for Manifest installation
[platform/core/appfw/wgt-backend.git] / src / hybrid / step / configuration / step_merge_tpk_config.cc
1 // Copyright (c) 2015 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.
4
5 #include "hybrid/step/configuration/step_merge_tpk_config.h"
6
7 #include <pkgmgrinfo_basic.h>
8
9 #include "hybrid/hybrid_backend_data.h"
10
11 namespace hybrid {
12 namespace configuration {
13
14 StepMergeTpkConfig::StepMergeTpkConfig(
15     common_installer::InstallerContext* context,
16     MergeType type) : Step(context), merge_type_(type) {
17 }
18
19 common_installer::Step::Status StepMergeTpkConfig::process() {
20   HybridBackendData* data =
21       static_cast<HybridBackendData*>(context_->backend_data.get());
22   manifest_x* tpk_data = data->tpk_manifest_data.get();
23   manifest_x* wgt_data = context_->manifest_data.get();
24
25   if (merge_type_ == MergeType::CONCAT)
26     wgt_data->application =
27         g_list_concat(wgt_data->application, tpk_data->application);
28   else
29     wgt_data->application = tpk_data->application;
30
31   tpk_data->application = nullptr;
32   return Status::OK;
33 }
34
35 }  // namespace configuration
36 }  // namespace hybrid