| 335 | } |
| 336 | |
| 337 | WASMEDGE_EXPORT bool Plugin::load(const std::filesystem::path &Path) noexcept { |
| 338 | std::error_code Error; |
| 339 | auto Status = std::filesystem::status(Path, Error); |
| 340 | if (likely(!Error)) { |
| 341 | if (std::filesystem::is_directory(Status)) { |
| 342 | bool Result = false; |
| 343 | for (const auto &Entry : std::filesystem::recursive_directory_iterator( |
| 344 | Path, std::filesystem::directory_options::skip_permission_denied, |
| 345 | Error)) { |
| 346 | const auto &EntryPath = Entry.path(); |
| 347 | if (Entry.is_regular_file(Error) && |
| 348 | EntryPath.extension().u8string() == WASMEDGE_LIB_EXTENSION) { |
| 349 | Result |= loadFile(EntryPath); |
| 350 | } |
| 351 | } |
| 352 | return Result; |
| 353 | } else if (std::filesystem::is_regular_file(Status) && |
| 354 | Path.extension().u8string() == WASMEDGE_LIB_EXTENSION) { |
| 355 | return loadFile(Path); |
| 356 | } |
| 357 | } |
| 358 | return false; |
| 359 | } |
| 360 | |
| 361 | bool Plugin::registerPlugin(const PluginDescriptor *Desc) noexcept { |
| 362 | if (Desc->APIVersion != CurrentAPIVersion) { |