Patched a bug with require
If there was a folder in root with the same name as a library, requiring that library would cause the require function to error. This has now been fixed.
This commit is contained in:
@@ -35,14 +35,17 @@ function _G.reqgen(load)
|
|||||||
return package.preloaded[module]
|
return package.preloaded[module]
|
||||||
end
|
end
|
||||||
local modulepath
|
local modulepath
|
||||||
if filesystem.exists(module) then
|
if filesystem.exists(module) and not filesystem.isDirectory(module) then
|
||||||
modulepath = module
|
modulepath = module
|
||||||
elseif filesystem.exists("/lib/" .. module .. ".lua") then
|
elseif
|
||||||
|
filesystem.exists("/lib/" .. module .. ".lua") and not filesystem.isDirectory("/lib/" .. module .. ".lua")
|
||||||
|
then
|
||||||
modulepath = "/lib/" .. module .. ".lua"
|
modulepath = "/lib/" .. module .. ".lua"
|
||||||
elseif
|
elseif
|
||||||
shell
|
shell
|
||||||
and shell.workingDirectory
|
and shell.workingDirectory
|
||||||
and filesystem.exists(filesystem.concat(shell.workingDirectory, module .. ".lua"))
|
and filesystem.exists(filesystem.concat(shell.workingDirectory, module .. ".lua"))
|
||||||
|
and not filesystem.isDirectory(filesystem.concat(shell.workingDirectory, module .. ".lua"))
|
||||||
then
|
then
|
||||||
modulepath = shell.workingDirectory .. module .. ".lua"
|
modulepath = shell.workingDirectory .. module .. ".lua"
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user