bf::path backup_xml_path =
GetBackupPathForManifestFile(context_->xml_path.get());
context_->backup_xml_path.set(backup_xml_path);
- bs::error_code error;
- bf::copy_file(context_->xml_path.get(), context_->backup_xml_path.get(),
- bf::copy_option::overwrite_if_exists, error);
- if (error) {
+ if (!MoveFile(context_->xml_path.get(), backup_xml_path, true) ||
+ !CopyFile(backup_xml_path, context_->xml_path.get())) {
LOG(ERROR) << "Failed to make a copy of xml manifest file";
return Status::MANIFEST_ERROR;
}
+
LOG(DEBUG) << "Manifest backup created";
return Status::OK;
}
#include "common/plugins/plugin.h"
#include "common/step/pkgmgr/step_run_parser_plugins.h"
+#include "common/utils/paths.h"
namespace bf = boost::filesystem;
namespace ci = common_installer;
context_->is_readonly_package.get()))
/ context_->pkgid.get();
xml_path += ".xml";
- context_->xml_path.set(xml_path);
+ context_->xml_path.set(GetBackupPathForManifestFile(xml_path));
return true;
}