Remove boost dependency
[platform/core/appfw/app-installers.git] / src / common / step / mount / step_unmount.cc
1 // Copyright (c) 2020 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 "step/mount/step_unmount.h"
6
7 #include <filesystem>
8 #include <string>
9
10 #include "common/utils/paths.h"
11 #include "common/tzip_interface.h"
12 #include "common/zip_interface.h"
13
14 namespace fs = std::filesystem;
15
16 namespace common_installer {
17 namespace mount {
18
19 Step::Status StepUnmount::process() {
20   auto zip_final = CreateZipInterface(
21       GetMountLocation(context_->GetPkgPath()));
22
23   if (!zip_final->UnmountZip()) {
24     LOG(ERROR) << "Failed to unmount zip package after installation";
25     return Status::APP_DIR_ERROR;
26   }
27
28   return Status::OK;
29 }
30
31 std::unique_ptr<IZipInterface> StepUnmount::CreateZipInterface(
32     const fs::path& mount_path) {
33   std::unique_ptr<IZipInterface> zip_interface(
34       new TzipInterface(mount_path));
35   return zip_interface;
36 }
37
38 }  // namespace mount
39 }  // namespace common_installer