#include "common/step/mount/step_mount_update.h"
-#include <boost/filesystem/operations.hpp>
-#include <boost/filesystem/path.hpp>
-
+#include <filesystem>
#include <string>
#include "common/shared_dirs.h"
#include "common/utils/file_util.h"
#include "common/utils/request.h"
-namespace bf = boost::filesystem;
-namespace bs = boost::system;
namespace ci = common_installer;
+namespace fs = std::filesystem;
namespace common_installer {
namespace mount {
Step::Status StepMountUpdate::process() {
- bs::error_code error;
+ std::error_code error;
- if (!bf::exists(backup_path_)) {
- bf::create_directories(backup_path_, error);
+ if (!fs::exists(backup_path_)) {
+ fs::create_directories(backup_path_, error);
if (error) {
LOG(ERROR) << "Failed to create backup directory: " << backup_path_;
return Status::APP_DIR_ERROR;
return Status::APP_DIR_ERROR;
}
- bf::path zip_destination_path =
+ fs::path zip_destination_path =
GetZipPackageLocation(context_->GetPkgPath(), context_->pkgid.get());
- bf::path backup_zip_location = GetBackupPathForZipFile(zip_destination_path);
+ fs::path backup_zip_location = GetBackupPathForZipFile(zip_destination_path);
if (!MoveFile(zip_destination_path, backup_zip_location)) {
LOG(ERROR) << "Files to create backup of zip package file";
context_->manifest_data.get()->zip_mount_file =
strdup(zip_destination_path.c_str());
- bf::path mount_point = GetMountLocation(context_->GetPkgPath());
+ fs::path mount_point = GetMountLocation(context_->GetPkgPath());
auto zip_final = CreateZipInterface(mount_point);
if (!zip_final->MountZip(zip_destination_path)) {
LOG(ERROR) << "Failed to mount zip package in installation path";
}
Step::Status StepMountUpdate::UmountPackagePath() {
- bf::path mount_point = GetMountLocation(context_->GetPkgPath());
+ fs::path mount_point = GetMountLocation(context_->GetPkgPath());
auto zip_final = CreateZipInterface(mount_point);
if (!zip_final->UnmountZip()) {
LOG(ERROR) << "Failed to unmount zip package after installation";
}
Step::Status StepMountUpdate::clean() {
- bf::path backup_zip_location =
+ fs::path backup_zip_location =
GetBackupPathForZipFile(GetZipPackageLocation(
context_->GetPkgPath(), context_->pkgid.get()));
Remove(backup_zip_location);
- if (bf::exists(backup_path_))
+ if (fs::exists(backup_path_))
RemoveAll(backup_path_);
return Status::OK;
Step::Status StepMountUpdate::undo() {
UmountPackagePath();
- bf::path zip_location = GetZipPackageLocation(
+ fs::path zip_location = GetZipPackageLocation(
context_->GetPkgPath(), context_->pkgid.get());
- bf::path backup_zip_location = GetBackupPathForZipFile(zip_location);
+ fs::path backup_zip_location = GetBackupPathForZipFile(zip_location);
- if (bf::exists(backup_zip_location)) {
+ if (fs::exists(backup_zip_location)) {
if (!Remove(zip_location))
return Status::APP_DIR_ERROR;
if (!MoveFile(backup_zip_location, zip_location)) {
}
// mount previous file for re-registration of trust anchor
- bf::path mount_point = GetMountLocation(context_->GetPkgPath());
+ fs::path mount_point = GetMountLocation(context_->GetPkgPath());
auto zip_final = CreateZipInterface(mount_point);
- bf::path zip_destination_path =
+ fs::path zip_destination_path =
GetZipPackageLocation(context_->GetPkgPath(), context_->pkgid.get());
if (!zip_final->MountZip(zip_destination_path)) {
LOG(ERROR) << "Failed to mount zip package in installation path";
}
}
- if (bf::exists(backup_path_))
+ if (fs::exists(backup_path_))
RemoveAll(backup_path_);
return Status::OK;
LOG(ERROR) << "root_application_path attribute is empty";
return Step::Status::INVALID_VALUE;
}
- if (!boost::filesystem::exists(context_->root_application_path.get())) {
+ if (!std::filesystem::exists(context_->root_application_path.get())) {
LOG(ERROR) << "root_application_path ("
<< context_->root_application_path.get()
<< ") path does not exist";
LOG(ERROR) << "unpacked_dir_path attribute is empty";
return Step::Status::INVALID_VALUE;
}
- if (!boost::filesystem::exists(context_->unpacked_dir_path.get())) {
+ if (!std::filesystem::exists(context_->unpacked_dir_path.get())) {
LOG(ERROR) << "unpacked_dir_path ("
<< context_->unpacked_dir_path.get()
<< ") path does not exist";
}
std::unique_ptr<IZipInterface> StepMountUpdate::CreateZipInterface(
- const boost::filesystem::path& mount_path) {
+ const fs::path& mount_path) {
std::unique_ptr<IZipInterface> zip_interface(
new TzipInterface(mount_path));
return zip_interface;