| 279 | } |
| 280 | |
| 281 | void |
| 282 | PluginFactory::cleanup() |
| 283 | { |
| 284 | std::error_code ec; |
| 285 | std::string path(RecConfigReadRuntimeDir()); |
| 286 | |
| 287 | try { |
| 288 | if (path.starts_with("/") && std::filesystem::is_directory(path)) { |
| 289 | for (const auto &entry : std::filesystem::directory_iterator(path, ec)) { |
| 290 | if (entry.is_directory()) { |
| 291 | std::string dir_name = entry.path().string(); |
| 292 | int dash_count = std::count(dir_name.begin(), dir_name.end(), '-'); // All UUIDs have 4 dashes |
| 293 | |
| 294 | if (dash_count == 4) { |
| 295 | std::filesystem::remove_all(dir_name, ec); |
| 296 | } |
| 297 | } |
| 298 | } |
| 299 | } |
| 300 | } catch (std::exception &e) { |
| 301 | PluginError("Error cleaning up runtime directory: %s", e.what()); |
| 302 | } |
| 303 | } |
| 304 | |
| 305 | /** |
| 306 | * @brief Find a plugin by path from our linked plugin list by using plugin effective (canonical) path |
nothing calls this directly
no test coverage detected