#include "common/step/filesystem/step_move_installed_storage.h"
-#include <boost/filesystem/path.hpp>
-#include <boost/system/error_code.hpp>
#include <tzplatform_config.h>
-#include <string>
#include <cstring>
+#include <filesystem>
+#include <string>
+#include <system_error>
#include "common/external_storage.h"
#include "common/shared_dirs.h"
#include "common/pkgmgr_registration.h"
#include "common/utils/pkgmgr_query.h"
-namespace bf = boost::filesystem;
-namespace bs = boost::system;
+namespace fs = std::filesystem;
namespace {
const char kInternalOnly[] = "internal-only";
-bool MoveFileAndUpdateTepInfo(const boost::filesystem::path& src,
- const boost::filesystem::path& dst,
+bool MoveFileAndUpdateTepInfo(const std::filesystem::path& src,
+ const std::filesystem::path& dst,
const common_installer::InstallerContext* context) {
- if (!bf::exists(src))
+ if (!fs::exists(src))
return true;
if (!common_installer::MoveFile(src, dst)) {
}
bool StepMoveInstalledStorage::MoveTep() {
- if (!bf::exists(new_tep_location_.parent_path())) {
- bs::error_code error;
- bf::create_directory(new_tep_location_.parent_path(), error);
+ if (!fs::exists(new_tep_location_.parent_path())) {
+ std::error_code error;
+ fs::create_directory(new_tep_location_.parent_path(), error);
if (error) {
LOG(ERROR) << "Failed to destination path for new tep location";
return false;
bool StepMoveInstalledStorage::MoveExtended() {
if (move_type_ == MoveType::TO_EXTENDED) {
old_pkg_location_ = context_->GetPkgPath();
- new_pkg_location_ = bf::path(GetExtendedRootAppPath(context_->uid.get())) /
+ new_pkg_location_ = fs::path(GetExtendedRootAppPath(context_->uid.get())) /
context_->pkgid.get();
context_->storage.set(Storage::EXTENDED);
} else {
- old_pkg_location_ = bf::path(GetExtendedRootAppPath(context_->uid.get())) /
+ old_pkg_location_ = fs::path(GetExtendedRootAppPath(context_->uid.get())) /
context_->pkgid.get();
- new_pkg_location_ = bf::path(GetRootAppPath(
+ new_pkg_location_ = fs::path(GetRootAppPath(
context_->is_readonly_package.get(), context_->uid.get())) /
context_->pkgid.get();
context_->storage.set(Storage::INTERNAL);
// create symlink for extended path
if (move_type_ == MoveType::TO_EXTENDED) {
- bs::error_code error;
- bf::create_symlink(new_pkg_location_, old_pkg_location_, error);
+ std::error_code error;
+ fs::create_symlink(new_pkg_location_, old_pkg_location_, error);
if (error) {
LOG(ERROR) << "Failed to create symlink for extended path: "
<< error.message();
bool StepMoveInstalledStorage::MoveBackExtended() {
if (move_type_ == MoveType::TO_EXTENDED) {
// Remove symlink if exist
- if (bf::exists(old_pkg_location_) &&
- bf::is_symlink(symlink_status(old_pkg_location_))) {
+ if (fs::exists(old_pkg_location_) &&
+ fs::is_symlink(symlink_status(old_pkg_location_))) {
if (!Remove(old_pkg_location_)) {
LOG(ERROR) << "Failed to remove symlink for extended path";
return false;
}
MoveDir(new_pkg_location_, old_pkg_location_);
if (move_type_ == MoveType::TO_INTERNAL) {
- bs::error_code error;
- bf::create_symlink(old_pkg_location_, new_pkg_location_, error);
+ std::error_code error;
+ fs::create_symlink(old_pkg_location_, new_pkg_location_, error);
if (error) {
LOG(ERROR) << "Failed to create symlink for extended path: "
<< error.message();
} // namespace filesystem
} // namespace common_installer
-