diff options
| author | ruki <[email protected]> | 2024-04-04 00:24:53 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2024-04-04 00:24:53 +0800 |
| commit | b0bc1ce397bb4b700c989df01d11b65b72ca800f (patch) | |
| tree | a8382840fd0c628a8b05b11752f8a8819096fcad /xmake/core | |
| parent | fee2d1b5106761728134c179375c73f9283a7ba1 (diff) | |
fix xmiopen
Diffstat (limited to 'xmake/core')
| -rw-r--r-- | xmake/core/sandbox/modules/import/core/sandbox/module.lua | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/xmake/core/sandbox/modules/import/core/sandbox/module.lua b/xmake/core/sandbox/modules/import/core/sandbox/module.lua index 64698a504..1cf2ace5c 100644 --- a/xmake/core/sandbox/modules/import/core/sandbox/module.lua +++ b/xmake/core/sandbox/modules/import/core/sandbox/module.lua @@ -305,26 +305,27 @@ function core_sandbox_module._load_from_shared(module_fullpath, opt) end libraryfiles = {} end - local script local module if #libraryfiles == 0 then libraryfiles = os.files(path.join(moduleinfo.buildir, "*module_*")) end if #libraryfiles > 0 then - local errors1, errors2 + local script, errors1, errors2 for _, libraryfile in ipairs(libraryfiles) do local modulename = path.basename(libraryfile):match("module_(.+)") - if package.loadxmi then - script, errors1 = package.loadxmi(libraryfile, "xmiopen_" .. modulename) - end - if not script then - script, errors2 = package.loadlib(libraryfile, "luaopen_" .. modulename) - end - if not script then - return nil, errors1 or errors2 or string.format("xmiopen_%s and luaopen_%s not found!", modulename, modulename) - end - module = script() - if module then + if modulename then + if package.loadxmi then + module, errors1 = package.loadxmi(libraryfile, "xmiopen_" .. modulename) + end + if not module then + script, errors2 = package.loadlib(libraryfile, "luaopen_" .. modulename) + if script then + module = script() + end + end + if not module then + return nil, errors1 or errors2 or string.format("xmiopen_%s and luaopen_%s not found!", modulename, modulename) + end break end end |
