Fix issues with searching for configuration file in subdirectories.

This commit is contained in:
abbie 2023-07-09 12:20:00 +01:00
parent 4cdbbbaf94
commit 104d67f31e
Signed by: threeoh6000
GPG key ID: 801FE4AD456E922C

View file

@ -3,7 +3,7 @@ _G._KERNEL_ROOT = "/"
_G._KERNEL_LOCS = {} _G._KERNEL_LOCS = {}
_G._BOOT_DEFAULT = nil _G._BOOT_DEFAULT = nil
_G._PELICAN_DEBUG = false _G._PELICAN_DEBUG = false
_G._PELICAN_VERSION = "0.1.0" _G._PELICAN_VERSION = "0.1.1"
_G._PELICAN_CONFIG_LOCATION = "" _G._PELICAN_CONFIG_LOCATION = ""
print("Pelican " .. _G._PELICAN_VERSION) print("Pelican " .. _G._PELICAN_VERSION)
@ -17,14 +17,14 @@ while v and _G._PELICAN_CONFIG_LOCATION == "" do
local files = fs.list(directories[s]) local files = fs.list(directories[s])
for i = 1, #files do for i = 1, #files do
if fs.isDir(fs.combine(directories[s], files[i])) then if fs.isDir(fs.combine(directories[s], files[i])) then
table.insert(directories, x, directories[s] .. files[i]) table.insert(directories, x, fs.combine(directories[s], files[i]))
x = x + 1 x = x + 1
elseif fs.getName(fs.combine(directories[s], files[i])) == "pelican.conf.lua" then elseif fs.getName(fs.combine(directories[s], files[i])) == "pelican.conf.lua" then
_G._PELICAN_CONFIG_LOCATION = fs.combine(directories[s], files[i]) _G._PELICAN_CONFIG_LOCATION = fs.combine(directories[s], files[i])
end end
end end
table.remove(directories, s) table.remove(directories, s)
s = s + 1 x = #directories + 1
if directories[s] == nil then if directories[s] == nil then
v = false v = false
end end