From de5d779d9a3f8f6dcb2ee061b752dc835ac5ba4d Mon Sep 17 00:00:00 2001 From: WahPlus Date: Sun, 28 Sep 2025 16:04:25 +0300 Subject: [PATCH] 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. --- halyde/kernel/boot.lua | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/halyde/kernel/boot.lua b/halyde/kernel/boot.lua index 1172b2f..10d984a 100644 --- a/halyde/kernel/boot.lua +++ b/halyde/kernel/boot.lua @@ -35,14 +35,17 @@ function _G.reqgen(load) return package.preloaded[module] end local modulepath - if filesystem.exists(module) then + if filesystem.exists(module) and not filesystem.isDirectory(module) then 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" elseif - shell - and shell.workingDirectory - and filesystem.exists(filesystem.concat(shell.workingDirectory, module .. ".lua")) + shell + and shell.workingDirectory + and filesystem.exists(filesystem.concat(shell.workingDirectory, module .. ".lua")) + and not filesystem.isDirectory(filesystem.concat(shell.workingDirectory, module .. ".lua")) then modulepath = shell.workingDirectory .. module .. ".lua" end