// Use of this source code is governed by an apache-2.0 license that can be
// found in the LICENSE file.
-#include <boost/exception/diagnostic_information.hpp>
-#include <boost/filesystem/operations.hpp>
-#include <boost/filesystem/path.hpp>
-
#include <glib.h>
#include <common/utils/file_util.h>
#include <common/utils/request.h>
#include <tzplatform_config.h>
#include <array>
+#include <exception>
+#include <filesystem>
#include <regex>
#include <string>
#include <vector>
-namespace bf = boost::filesystem;
namespace ci = common_installer;
+namespace fs = std::filesystem;
namespace {
break;
}
- if (!boost::filesystem::exists(line_data))
+ if (!std::filesystem::exists(line_data))
continue;
arguments.emplace_back(line_data);
if (std::string(type) == "unified") {
auto arguments = ParseRecoveryFile(file);
if (!arguments.size())
- return ci::Remove(bf::path(file));
+ return ci::Remove(fs::path(file));
arguments.emplace(arguments.begin(), "-b");
arguments.emplace_back("-u");
if (WIFSIGNALED(status) || WEXITSTATUS(status))
return false;
- ci::Remove(bf::path(file));
+ ci::Remove(fs::path(file));
return true;
}
}
void PkgRecoveryService::SearchBackupFiles(uid_t uid) {
- const bf::path recovery_dir = ci::GetRootAppPath(false, uid);
+ const fs::path recovery_dir = ci::GetRootAppPath(false, uid);
try {
- for (bf::directory_iterator iter(recovery_dir);
- iter != bf::directory_iterator();
+ for (fs::directory_iterator iter(recovery_dir);
+ iter != fs::directory_iterator();
++iter) {
std::string file = iter->path().filename().string();
std::regex backup_regex(kBackupFilePattern);
std::smatch match;
if (std::regex_search(file, match, backup_regex)) {
- bf::path orig_file(iter->path().parent_path() / iter->path().stem());
- if (bf::exists(orig_file))
- bf::remove(orig_file);
- bf::rename(iter->path(), orig_file);
+ fs::path orig_file(iter->path().parent_path() / iter->path().stem());
+ if (fs::exists(orig_file))
+ fs::remove(orig_file);
+ fs::rename(iter->path(), orig_file);
}
}
- } catch (...) {
+ } catch (const std::exception& e) {
LOG(WARNING) << "Exception occurred: "
- << boost::current_exception_diagnostic_information();
+ << typeid(e).name() << ", " << e.what();
}
}
std::vector<RecoverEntry> PkgRecoveryService::SearchRecoveryFiles(uid_t uid) {
std::vector<RecoverEntry> list;
- const bf::path recovery_dir = ci::GetRootAppPath(false, uid);
+ const fs::path recovery_dir = ci::GetRootAppPath(false, uid);
LOG(INFO) << "RootAppPath: " << recovery_dir;
- for (bf::directory_iterator iter(recovery_dir);
- iter != bf::directory_iterator();
+ for (fs::directory_iterator iter(recovery_dir);
+ iter != fs::directory_iterator();
++iter) {
try {
std::string file = iter->path().filename().string();
else
list.emplace_back(type, iter->path().string());
}
- } catch (...) {
+ } catch (const std::exception& e) {
LOG(WARNING) << "Exception occurred: "
- << boost::current_exception_diagnostic_information();
+ << typeid(e).name() << ", " << e.what();
continue;
}
}
for (const auto& entry : entries) {
const char* type = entry.first.c_str();
const char* file = entry.second.c_str();
- if (!bf::exists(file))
+ if (!fs::exists(file))
continue;
if (!RunBackend(uid, type, file))