Actually add add_lib_ppl, whoops.

This commit is contained in:
v 2020-12-29 12:23:52 +00:00
parent 8f8a6d19a9
commit 83c25fc26a
2 changed files with 34 additions and 0 deletions

13
add_lib_ppl/pkgmeta.ltn Normal file
View File

@ -0,0 +1,13 @@
{
["version"] = "0.1.0",
["dependencies"] = {
},
["description"] = "Makes require look in /lib. Don't ask how. You really don't want to know.",
["files"] = {
["startup"] = {
".__add_lib_ppl.lua"
}
},
["restart_on_inst"]=1,
}

View File

@ -0,0 +1,21 @@
local function loader(mn)
local at=nil
if fs.exists(shell.dir().."/lib/"..mn..".lua") then
at=shell.dir().."/lib/"..mn..".lua"
elseif fs.exists("/lib/"..mn..".lua") then
at="/lib/"..mn..".lua"
end
if at then
return function() return dofile(at) end
end
return false,"\t\tno file '/lib/"..mn..".lua\n\t\tno file '"..shell.dir().."/lib/"..mn..".lua"
end
local osrun=_G.os.run
function _G.os.run(e,p,...)
if e.package then
table.insert(e.package.loaders,loader)
end
return osrun(e,p,...)
end