文件模块save方法新增d参数
This commit is contained in:
@@ -44,15 +44,20 @@ function FILE.save(data,name,mode)
|
||||
data=tostring(data)
|
||||
end
|
||||
|
||||
if mode:find'd'and fs.getInfo(name)then
|
||||
MES.new('error',text.saveError_duplicate)
|
||||
return
|
||||
end
|
||||
local F=fs.newFile(name)
|
||||
F:open'w'
|
||||
local success,mes=F:write(data)
|
||||
F:flush()F:close()
|
||||
if not success then
|
||||
if success then
|
||||
return true
|
||||
else
|
||||
MES.new('error',text.saveError..(mes or"unknown error"))
|
||||
MES.traceback()
|
||||
end
|
||||
return success
|
||||
end
|
||||
function FILE.clear(path)
|
||||
if fs.getRealDirectory(path)~=SAVEDIR or fs.getInfo(path).type~='directory'then return end
|
||||
|
||||
@@ -62,6 +62,7 @@ return{
|
||||
|
||||
saveDone="Data Saved",
|
||||
saveError="Failed to save:",
|
||||
saveError_duplicate="Duplicate filename",
|
||||
loadError="Failed to load:",
|
||||
exportSuccess="Exported successfully",
|
||||
importSuccess="Imported successfully",
|
||||
|
||||
@@ -51,6 +51,7 @@ return{
|
||||
|
||||
saveDone="Datos guardados",
|
||||
saveError="Error al guardar:",
|
||||
-- saveError_duplicate="Duplicate filename",
|
||||
loadError="Error al cargar:",
|
||||
exportSuccess="Exportado con éxito",
|
||||
importSuccess="Importado con éxito",
|
||||
|
||||
@@ -52,6 +52,7 @@ return{
|
||||
|
||||
saveDone="Données sauvegardées",
|
||||
saveError="Sauvegarde échouée : ",
|
||||
-- saveError_duplicate="Duplicate filename",
|
||||
loadError="Lecture échouée : ",
|
||||
exportSuccess="Exporté avec succès",
|
||||
importSuccess="Importé avec succès",
|
||||
|
||||
@@ -52,6 +52,7 @@ return{
|
||||
|
||||
saveDone="Data Salva",
|
||||
saveError="Falha ao salvar:",
|
||||
-- saveError_duplicate="Duplicate filename",
|
||||
loadError="Falha ao ler:",
|
||||
exportSuccess="Exportado com sucesso",
|
||||
importSuccess="Importado com sucesso",
|
||||
|
||||
@@ -38,6 +38,7 @@ return{
|
||||
|
||||
saveDone="~~~",
|
||||
saveError="x!:",
|
||||
saveError_duplicate="X←→X ?",
|
||||
loadError="x!:",
|
||||
exportSuccess="~Out~",
|
||||
importSuccess="~In~",
|
||||
|
||||
@@ -62,6 +62,7 @@ return{
|
||||
|
||||
saveDone="保存成功!",
|
||||
saveError="保存失败:",
|
||||
saveError_duplicate="文件名重复",
|
||||
loadError="读取失败:",
|
||||
exportSuccess="导出成功",
|
||||
importSuccess="导入成功",
|
||||
|
||||
Reference in New Issue
Block a user