diff options
| author | ruki <[email protected]> | 2024-04-01 23:58:16 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2024-04-01 23:58:16 +0800 |
| commit | a881ec111510bd47d7dc374880ff6bcce2e3d42d (patch) | |
| tree | 81de985842bb581c94bbfb35062bb4d69fd4d255 | |
| parent | c967ee6b357b1ccd9d9f63f8cc24a560c798ab43 (diff) | |
fix find_and_load
| -rw-r--r-- | xmake/core/sandbox/modules/import/core/sandbox/module.lua | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/xmake/core/sandbox/modules/import/core/sandbox/module.lua b/xmake/core/sandbox/modules/import/core/sandbox/module.lua index cc3fd7794..28b327568 100644 --- a/xmake/core/sandbox/modules/import/core/sandbox/module.lua +++ b/xmake/core/sandbox/modules/import/core/sandbox/module.lua @@ -198,23 +198,14 @@ function core_sandbox_module._load(dir, name, opt) local module local modulekind = opt.modulekind if modulekind == MODULE_KIND_LUAFILE then - local result, errors = core_sandbox_module._load_from_scriptfile(module_fullpath, opt) - if not result then - return nil, errors - end - module = result - script = errors + module, script = core_sandbox_module._load_from_scriptfile(module_fullpath, opt) elseif modulekind == MODULE_KIND_LUADIR then - local result, errors = core_sandbox_module._load_from_scriptdir(module_fullpath, opt) - if not result then - return nil, errors - end - module = result - script = errors + module, script = core_sandbox_module._load_from_scriptdir(module_fullpath, opt) elseif modulekind == MODULE_KIND_BINARY then -- load binary module end if not module then - return nil, string.format("module: %s not found!", name) + local errors = script + return nil, errors or string.format("module: %s not found!", name) end return module, script end @@ -399,7 +390,7 @@ function core_sandbox_module.import(name, opt) -- load module.interface if module2_name and interface_name then - found2, module2, errors2 = core_sandbox_module._find_and_load(module2_name, opt, instance, modules, modules_directories) + found2, module2, errors2 = core_sandbox_module._find_and_load(module2_name, loadopt) if found2 and module2 and module2[interface_name] then module = module2[interface_name] found = true |
