diff --git a/src/main/resources/assets/computercraft/lua/rom/programs/edit.lua b/src/main/resources/assets/computercraft/lua/rom/programs/edit.lua index 6a3b3b914c..f39cee1d9f 100644 --- a/src/main/resources/assets/computercraft/lua/rom/programs/edit.lua +++ b/src/main/resources/assets/computercraft/lua/rom/programs/edit.lua @@ -93,7 +93,7 @@ local function save( _sPath ) -- Save local file = nil local function innerSave() - file = fs.open( _sPath, "w" ) + file, fileerr = fs.open( _sPath, "w" ) if file then for n, sLine in ipairs( tLines ) do file.write( sLine .. "\n" ) @@ -107,7 +107,7 @@ local function save( _sPath ) if file then file.close() end - return ok, err + return ok, err, fileerr end local tKeywords = { @@ -287,11 +287,15 @@ local tMenuFuncs = { if bReadOnly then sStatus = "Access denied" else - local ok, err = save( sPath ) + local ok, err, fileerr = save( sPath ) if ok then sStatus="Saved to "..sPath else - sStatus="Error saving to "..sPath + if fileerr then + sStatus="Error saving to "..fileerr + else + sStatus="Error saving to "..sPath + end end end redrawMenu() @@ -770,3 +774,4 @@ end term.clear() term.setCursorBlink( false ) term.setCursorPos( 1, 1 ) + diff --git a/src/main/resources/assets/computercraft/lua/rom/programs/fun/advanced/paint.lua b/src/main/resources/assets/computercraft/lua/rom/programs/fun/advanced/paint.lua index 59089054da..d57954a1d7 100644 --- a/src/main/resources/assets/computercraft/lua/rom/programs/fun/advanced/paint.lua +++ b/src/main/resources/assets/computercraft/lua/rom/programs/fun/advanced/paint.lua @@ -128,9 +128,9 @@ local function save(path) fs.makeDir(sDir) end - local file = fs.open( path, "w" ) + local file, err = fs.open( path, "w" ) if not file then - return false + return false, err end -- Encode (and trim) @@ -313,11 +313,15 @@ local function accessMenu() fMessage = "Access denied" return false end - local success = save(sPath) + local success, err = save(sPath) if success then fMessage = "Saved to "..sPath else - fMessage = "Error saving to "..sPath + if err then + fMessage = "Error saving to "..err + else + fMessage = "Error saving to "..sPath + end end return false elseif mChoices[selection]=="Exit" then @@ -401,3 +405,4 @@ term.setBackgroundColour(colours.black) term.setTextColour(colours.white) term.clear() term.setCursorPos(1,1) +