c56feb96261bc906731629eab171c9c894293794
[platform/core/appfw/app-installers.git] / src / common / step / pkgmgr / step_remove_manifest.cc
1 // Copyright (c) 2016 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/pkgmgr/step_remove_manifest.h"
6
7 #include <boost/filesystem/path.hpp>
8 #include <boost/filesystem/operations.hpp>
9 #include <boost/system/error_code.hpp>
10
11 #include <pkgmgr-info.h>
12 #include <pkgmgr_installer.h>
13 #include <tzplatform_config.h>
14
15 #include <algorithm>
16 #include <string>
17
18 #include "common/utils/file_util.h"
19
20 namespace bf = boost::filesystem;
21 namespace bs = boost::system;
22
23 namespace common_installer {
24 namespace pkgmgr {
25
26
27 common_installer::Step::Status StepRemoveManifest::clean() {
28   bf::path manifest_path;
29   if (context_->request_type.get() == RequestType::ReadonlyUpdateUninstall) {
30     manifest_path = bf::path(tzplatform_getenv(TZ_SYS_RW_PACKAGES)) /
31         context_->pkgid.get();
32     manifest_path += ".xml";
33   } else {
34     manifest_path = context_->xml_path.get();
35   }
36
37   LOG(DEBUG) << "Remove manifest file";
38   Remove(manifest_path);
39   return Status::OK;
40 }
41
42
43 }  // namespace pkgmgr
44 }  // namespace common_installer