Remove boost dependency
[platform/core/appfw/app-installers.git] / src / common / step / filesystem / step_remove_tep.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_tep.h"
6
7 #include <filesystem>
8
9 namespace fs = std::filesystem;
10
11 namespace common_installer {
12 namespace filesystem {
13
14 Step::Status StepRemoveTep::process() {
15   if (context_->manifest_data.get()->tep_name) {
16     fs::path tep_path(context_->manifest_data.get()->tep_name);
17     if (fs::exists(tep_path)) {
18       std::error_code error;
19       fs::remove(tep_path, error);
20       if (error) {
21         // Deinstallation should not fail even if sd card is not inserted
22         // In spite of this, we print only warning
23         LOG(WARNING) << "Failed to remove tep file from: " << tep_path;
24       }
25     }
26     LOG(DEBUG) << "Tep package file removed: " << tep_path;
27   }
28   return Status::OK;
29 }
30
31 }  // namespace filesystem
32 }  // namespace common_installer