MCPcopy Create free account
hub / github.com/WasmEdge/WasmEdge / load

Method load

lib/plugin/plugin.cpp:337–359  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

335}
336
337WASMEDGE_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
361bool Plugin::registerPlugin(const PluginDescriptor *Desc) noexcept {
362 if (Desc->APIVersion != CurrentAPIVersion) {

Callers 1

loadFileMethod · 0.45

Calls 2

pathMethod · 0.80
likelyFunction · 0.50

Tested by

no test coverage detected