Remove boost dependency
[platform/core/appfw/app-installers.git] / src / common / step / mount / step_check_mount_path.cc
1 // Copyright (c) 2018 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_check_mount_path.h"
6
7 #include <filesystem>
8 #include <string>
9
10 #include "common/utils/paths.h"
11
12 namespace fs = std::filesystem;
13
14 namespace common_installer {
15 namespace mount {
16
17 Step::Status StepCheckMountPath::process() {
18   fs::path zip_destination_path =
19       GetZipPackageLocation(context_->GetPkgPath(), context_->pkgid.get());
20   if (!fs::exists(zip_destination_path))
21     return Status::OK;
22
23   context_->manifest_data.get()->zip_mount_file =
24       strdup(zip_destination_path.c_str());
25
26   return Status::OK;
27 }
28
29 Step::Status StepCheckMountPath::precheck() {
30   if (context_->root_application_path.get().empty()) {
31     LOG(ERROR) << "root_application_path attribute is empty";
32     return Step::Status::INVALID_VALUE;
33   }
34
35   if (context_->pkgid.get().empty()) {
36     LOG(ERROR) << "pkgid attribute is empty";
37     return Step::Status::PACKAGE_NOT_FOUND;
38   }
39
40   return Step::Status::OK;
41 }
42
43 }  // namespace mount
44 }  // namespace common_installer