}
bool Remove(const bf::path& path) {
- if (!exists(path) && !bf::is_symlink(bf::symlink_status(path)))
+ bs::error_code error;
+ if (!exists(path, error)) {
+ if (error) {
+ LOG(ERROR) << "Cannot remove: " << path << ", " << error.message();
+ return false;
+ }
+ return true;
+ }
+ if (!bf::is_symlink(bf::symlink_status(path)))
return true;
- bs::error_code error;
bf::remove(path, error);
-
if (error) {
LOG(ERROR) << "Cannot remove: " << path << ", " << error.message();
return false;
void PkgRecoveryService::SearchBackupFiles(uid_t uid) {
const bf::path recovery_dir = ci::GetRootAppPath(false, uid);
- for (bf::directory_iterator iter(recovery_dir);
- iter != bf::directory_iterator();
- ++iter) {
- try {
+ try {
+ for (bf::directory_iterator iter(recovery_dir);
+ iter != bf::directory_iterator();
+ ++iter) {
+
std::string file = iter->path().filename().string();
std::regex backup_regex(kBackupFilePattern);
std::smatch match;
else
bf::rename(iter->path(), orig_file);
}
- } catch (...) {
- LOG(WARNING) << "Exception occurred: "
- << boost::current_exception_diagnostic_information();
- continue;
}
+ } catch (...) {
+ LOG(WARNING) << "Exception occurred: "
+ << boost::current_exception_diagnostic_information();
}
}