修正加载文件的时候会因为没有应用语言没法弹出消息而报错
This commit is contained in:
@@ -15,41 +15,46 @@ local playSFX=SFX.play
|
|||||||
|
|
||||||
|
|
||||||
--System
|
--System
|
||||||
function loadFile(name,args)
|
do--function loadFile(name,args), function saveFile(data,name,args)
|
||||||
if not args then args=''end
|
local t=setmetatable({},{__index=function()return"'$1' loading failed: $2"end})
|
||||||
local res,mes=pcall(FILE.load,name,args)
|
function loadFile(name,args)
|
||||||
if res then
|
local text=text or t
|
||||||
return mes
|
if not args then args=''end
|
||||||
else
|
local res,mes=pcall(FILE.load,name,args)
|
||||||
if mes:find'open error'then
|
if res then
|
||||||
MES.new('error',text.loadError_open:repD(name))
|
return mes
|
||||||
elseif mes:find'unknown mode'then
|
|
||||||
MES.new('error',text.loadError_errorMode:repD(name,args))
|
|
||||||
elseif mes:find'no file'then
|
|
||||||
if not args:sArg'-canSkip'then
|
|
||||||
MES.new('error',text.loadError_noFile:repD(name))
|
|
||||||
end
|
|
||||||
elseif mes then
|
|
||||||
MES.new('error',text.loadError_other:repD(name,mes))
|
|
||||||
else
|
else
|
||||||
MES.new('error',text.loadError_unknown:repD(name))
|
if mes:find'open error'then
|
||||||
|
MES.new('error',text.loadError_open:repD(name,""))
|
||||||
|
elseif mes:find'unknown mode'then
|
||||||
|
MES.new('error',text.loadError_errorMode:repD(name,args))
|
||||||
|
elseif mes:find'no file'then
|
||||||
|
if not args:sArg'-canSkip'then
|
||||||
|
MES.new('error',text.loadError_noFile:repD(name,""))
|
||||||
|
end
|
||||||
|
elseif mes then
|
||||||
|
MES.new('error',text.loadError_other:repD(name,mes))
|
||||||
|
else
|
||||||
|
MES.new('error',text.loadError_unknown:repD(name,""))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
function saveFile(data,name,args)
|
||||||
function saveFile(data,name,args)
|
local text=text or t
|
||||||
local res,mes=pcall(FILE.save,data,name,args)
|
local res,mes=pcall(FILE.save,data,name,args)
|
||||||
if res then
|
if res then
|
||||||
return mes
|
return mes
|
||||||
else
|
else
|
||||||
MES.new('error',
|
MES.new('error',
|
||||||
mes:find'duplicate'and
|
mes:find'duplicate'and
|
||||||
text.saveError_duplicate:repD(name)or
|
text.saveError_duplicate:repD(name)or
|
||||||
mes:find'encode error'and
|
mes:find'encode error'and
|
||||||
text.saveError_encode:repD(name)or
|
text.saveError_encode:repD(name)or
|
||||||
mes and
|
mes and
|
||||||
text.saveError_other:repD(name,mes)or
|
text.saveError_other:repD(name,mes)or
|
||||||
text.saveError_unknown:repD(name)
|
text.saveError_unknown:repD(name)
|
||||||
)
|
)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function isSafeFile(file,mes)
|
function isSafeFile(file,mes)
|
||||||
|
|||||||
Reference in New Issue
Block a user