Remove boost dependency
[platform/core/appfw/app-installers.git] / src / common / step / filesystem / step_remove_zip_image.cc
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.
4
5 #include "common/step/filesystem/step_remove_zip_image.h"
6
7 #include <algorithm>
8 #include <filesystem>
9 #include <string>
10 #include <vector>
11
12 #include "common/utils/paths.h"
13 #include "common/pkgmgr_registration.h"
14 #include "common/utils/pkgmgr_query.h"
15 #include "common/utils/file_util.h"
16
17 namespace fs = std::filesystem;
18
19 namespace common_installer {
20 namespace filesystem {
21
22 Step::Status StepRemoveZipImage::precheck() {
23   if (!context_->manifest_data.get())
24     LOG(ERROR) << "manifest_data is not set";
25   return Step::Status::OK;
26 }
27
28 Step::Status StepRemoveZipImage::process() {
29   fs::path zip_image_path =
30       GetZipPackageLocation(context_->GetPkgPath(), context_->pkgid.get());
31   if (fs::exists(zip_image_path)) {
32     if (Remove(zip_image_path))
33       LOG(INFO) << "Zip image file removed: " << zip_image_path;
34   }
35   return Status::OK;
36 }
37
38 }  // namespace filesystem
39 }  // namespace common_installer