每次启动时都会检查存档路径是否有文件夹
This commit is contained in:
14
main.lua
14
main.lua
@@ -250,9 +250,19 @@ for _,v in next,fs.getDirectoryItems("parts/scenes")do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--Create directories
|
||||||
|
for _,v in next,{"conf","record","replay"}do
|
||||||
|
local info=fs.getInfo(v)
|
||||||
|
if info then
|
||||||
|
if info.type=="directory"then goto NEXT end
|
||||||
|
fs.remove(v)
|
||||||
|
end
|
||||||
|
fs.createDirectory(v)
|
||||||
|
::NEXT::
|
||||||
|
end
|
||||||
|
|
||||||
--Collect files
|
--Collect files
|
||||||
if fs.getInfo("data.dat")then
|
if fs.getInfo("data.dat")then
|
||||||
fs.createDirectory("conf")
|
|
||||||
for k,v in next,{
|
for k,v in next,{
|
||||||
["settings.dat"]="conf/settings",
|
["settings.dat"]="conf/settings",
|
||||||
["unlock.dat"]="conf/unlock",
|
["unlock.dat"]="conf/unlock",
|
||||||
@@ -264,14 +274,12 @@ if fs.getInfo("data.dat")then
|
|||||||
fs.write(v,fs.read(k))
|
fs.write(v,fs.read(k))
|
||||||
fs.remove(k)
|
fs.remove(k)
|
||||||
end
|
end
|
||||||
fs.createDirectory("record")
|
|
||||||
for _,name in next,fs.getDirectoryItems("")do
|
for _,name in next,fs.getDirectoryItems("")do
|
||||||
if name:sub(-4)==".dat"then
|
if name:sub(-4)==".dat"then
|
||||||
fs.write("record/"..name:sub(1,-4).."rec",fs.read(name))
|
fs.write("record/"..name:sub(1,-4).."rec",fs.read(name))
|
||||||
fs.remove(name)
|
fs.remove(name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
fs.createDirectory("replay")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--Load files
|
--Load files
|
||||||
|
|||||||
Reference in New Issue
Block a user