if (!GetPackageInfo(parser, info)) {
LOG(ERROR) << "Failed to get package info";
- bf::remove_all(tmp_dir);
+ ci::RemoveAll(tmp_dir);
return false;
}
if (!GetAuthorInfo(parser, info))
bf::path icon_path = bf::path(kSharedResDir) / icon;
if (!ExtractPackageArchive(
file_path, icon_path.string().c_str(), tmp_dir)) {
- bf::remove_all(tmp_dir);
+ ci::RemoveAll(tmp_dir);
return false;
}
if (!ReadIcon(icon_path, tmp_dir, info)) {
LOG(WARNING) << "Failed to get icon info";
- bf::remove_all(tmp_dir);
+ ci::RemoveAll(tmp_dir);
return false;
}
}
free(locale);
- bf::remove_all(tmp_dir);
+ ci::RemoveAll(tmp_dir);
return true;
}
ci::Step::Status StepTpkUpdatePackageDirectory::RemoveDirectory(
const boost::filesystem::path& dir_path) {
- if (bf::exists(dir_path)) {
- bs::error_code error;
- bf::remove_all(dir_path, error);
- if (error) {
- LOG(ERROR) << "Failed to remove directory: " << dir_path;
- return Status::APP_DIR_ERROR;
- }
- }
+ if (!ci::RemoveAll(dir_path))
+ return Status::APP_DIR_ERROR;
return Status::OK;
}
#include <string>
+#include "common/utils/file_util.h"
namespace bs = boost::system;
namespace bf = boost::filesystem;
+namespace ci = common_installer;
namespace {
common_installer::Step::Status StepConvertXml::undo() {
if (!backup_path_.empty()) {
- bs::error_code error;
- bf::remove(new_path_, error);
- if (error) {
- LOG(WARNING) << "Failed to remove " << new_path_
- << " due to error " << error;
- } else {
+ if (Remove(new_path_) {
+ bs::error_code error;
bf::rename(backup_path_, new_path_, error);
if (error)
LOG(WARNING) << "Failed to restore " << new_path_
return {};
if (!common_installer::ExtractToTmpDir(path.c_str(), tmp_path,
kManifestFileName)) {
- bf::remove_all(tmp_path, code);
+ ci::RemoveAll(tmp_path);
return {};
}
bf::path manifest_path = tmp_path / kManifestFileName;
if (!bf::exists(manifest_path)) {
- bf::remove_all(tmp_path, code);
+ ci::RemoveAll(tmp_path);
return {};
}
if (!package_info)
return {};
std::string pkg_id = package_info->package();
- bf::remove_all(tmp_path, code);
+ ci::RemoveAll(tmp_path);
return pkg_id;
}