更严谨的背景文件读取,不会读到非lua文件
This commit is contained in:
6
main.lua
6
main.lua
@@ -285,8 +285,10 @@ end
|
|||||||
--Load background files from SOURCE ONLY
|
--Load background files from SOURCE ONLY
|
||||||
for _,v in next,love.filesystem.getDirectoryItems("parts/backgrounds")do
|
for _,v in next,love.filesystem.getDirectoryItems("parts/backgrounds")do
|
||||||
if love.filesystem.getRealDirectory("parts/backgrounds/"..v)~=SAVEDIR then
|
if love.filesystem.getRealDirectory("parts/backgrounds/"..v)~=SAVEDIR then
|
||||||
local name=v:sub(1,-5)
|
if v:sub(-3)=="lua"then
|
||||||
BG.add(name,require("parts/backgrounds/"..name))
|
local name=v:sub(1,-5)
|
||||||
|
BG.add(name,require("parts/backgrounds/"..name))
|
||||||
|
end
|
||||||
else
|
else
|
||||||
LOG.print("Dangerous file : %SAVE%/parts/backgrounds/"..v)
|
LOG.print("Dangerous file : %SAVE%/parts/backgrounds/"..v)
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user