clean cache directory
This commit is contained in:
parent
26714a836c
commit
dfb9d78448
@ -234,6 +234,14 @@ E_SIMPLE3(orphaned_file_processing_failed, error, true,
|
||||
std::string, result, res, E_STRING
|
||||
);
|
||||
|
||||
E_SIMPLE1(orphaned_source_file_detected, info, true,
|
||||
std::string, source, src, E_STRING
|
||||
);
|
||||
|
||||
E_SIMPLE1(orphaned_source_file_removed, info, true,
|
||||
std::string, source, src, E_STRING
|
||||
);
|
||||
|
||||
E_SIMPLE1(polling_item_begin, debug, true,
|
||||
std::string, item_name, item, E_STRING
|
||||
);
|
||||
|
@ -527,6 +527,21 @@ void base_provider::remove_deleted_files() {
|
||||
item.api_path, item.source_path);
|
||||
}
|
||||
}
|
||||
|
||||
auto source_list =
|
||||
utils::file::directory{config_.get_cache_directory()}.get_files();
|
||||
for (auto &&source_file : source_list) {
|
||||
filesystem_item fsi{};
|
||||
if (get_filesystem_item_from_source_path(source_file->get_path(), fsi) !=
|
||||
api_error::item_not_found) {
|
||||
event_system::instance().raise<orphaned_source_file_detected>(
|
||||
source_file->get_path());
|
||||
if (source_file->remove()) {
|
||||
event_system::instance().raise<orphaned_source_file_removed>(
|
||||
source_file->get_path());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
auto base_provider::remove_file(const std::string &api_path) -> api_error {
|
||||
|
Loading…
x
Reference in New Issue
Block a user