From 7837064e805d0046a3ede5773cbd51910e2aa178 Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Mon, 12 Apr 2021 12:55:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8D=E5=86=8D=E6=8E=A5=E5=8F=97=E8=BF=87?= =?UTF-8?q?=E8=80=81=E7=89=88=E6=9C=AC=E7=9A=84=E5=AD=98=E6=A1=A3=EF=BC=8C?= =?UTF-8?q?=E6=AF=8F=E6=AC=A1=E5=90=AF=E5=8A=A8=E5=88=A0=E9=99=A4=E5=AD=98?= =?UTF-8?q?=E6=A1=A3=E6=96=87=E4=BB=B6=E5=A4=B9=E5=86=85=E8=A3=B8=E9=9C=B2?= =?UTF-8?q?=E7=9A=84=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.lua | 32 ++++++++------------------------ 1 file changed, 8 insertions(+), 24 deletions(-) diff --git a/main.lua b/main.lua index c8b686cf..4c5de208 100644 --- a/main.lua +++ b/main.lua @@ -33,40 +33,24 @@ love.keyboard.setKeyRepeat(true) love.keyboard.setTextInput(false) love.mouse.setVisible(false) +--Delete all files from too old version +for _,name in next,fs.getDirectoryItems("")do + if fs.getRealDirectory(name)==SAVEDIR and fs.getInfo(name).type~="directory"then + fs.remove(name) + end +end + --Create directories for _,v in next,{"conf","record","replay","cache"}do local info=fs.getInfo(v) if not info then fs.createDirectory(v) - elseif info.type ~= 'directory' then + elseif info.type~="directory"then fs.remove(v) fs.createDirectory(v) end end ---Collect files of old version -if fs.getInfo("data.dat")or fs.getInfo("key.dat")or fs.getInfo("settings.dat")then - for k,v in next,{ - ["settings.dat"]="conf/settings", - ["unlock.dat"]="conf/unlock", - ["data.dat"]="conf/data", - ["key.dat"]="conf/key", - ["virtualkey.dat"]="conf/virtualkey", - ["account.dat"]="conf/user", - }do - if fs.getInfo(k)then - fs.write(v,fs.read(k)) - fs.remove(k) - end - end - for _,name in next,fs.getDirectoryItems("")do - if name:sub(-4)==".dat"then - fs.write("record/"..name:sub(1,-4).."rec",fs.read(name)) - fs.remove(name) - end - end -end - --Load modules require"Zframework"