* Move build directory * Move build folder * Move the build folder * Update Mac OS icon * Use snapshot icon * Use icon file * Temporary fix for Mac OS dylib loading * Update require.lua * Update require.lua * Update require.lua * Update require.lua Remember to squash this. * “简化”require模块对于OS X环境的处理方法 Co-authored-by: MrZ626 <1046101471@qq.com>
34 lines
1.1 KiB
Lua
34 lines
1.1 KiB
Lua
package.cpath=package.cpath..';'..SAVEDIR..'/lib/lib?.so;'..'?.dylib'
|
|
local loaded={}
|
|
return function(libName)
|
|
local require=require
|
|
if SYSTEM=='OS X'then
|
|
require=package.loadlib(libName..'.dylib','luaopen_'..libName)
|
|
libname=nil
|
|
elseif SYSTEM=='Android'then
|
|
if not loaded[libName]then
|
|
local platform=(function()
|
|
local p=io.popen('uname -m')
|
|
local arch=p:read('*a'):lower()
|
|
p:close()
|
|
if arch:find('v8')or arch:find('64')then
|
|
return'arm64-v8a'
|
|
else
|
|
return'armeabi-v7a'
|
|
end
|
|
end)()
|
|
love.filesystem.write(
|
|
'lib/libCCloader.so',
|
|
love.filesystem.read('data','libAndroid/'..platform..'/libCCloader.so')
|
|
)
|
|
loaded[libName]=true
|
|
end
|
|
end
|
|
local success,res=pcall(require,libName)
|
|
if success and res then
|
|
return res
|
|
else
|
|
MES.new('error',"Cannot load "..libName..": "..res)
|
|
end
|
|
end
|