mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-01-28 18:04:47 +00:00
Merge pull request #390 from Wilma456/ComputerCraft-1/errormsg
Show fs error in paint and edit
This commit is contained in:
commit
6691ec8e3a
@ -93,7 +93,7 @@ local function save( _sPath )
|
|||||||
-- Save
|
-- Save
|
||||||
local file = nil
|
local file = nil
|
||||||
local function innerSave()
|
local function innerSave()
|
||||||
file = fs.open( _sPath, "w" )
|
file, fileerr = fs.open( _sPath, "w" )
|
||||||
if file then
|
if file then
|
||||||
for n, sLine in ipairs( tLines ) do
|
for n, sLine in ipairs( tLines ) do
|
||||||
file.write( sLine .. "\n" )
|
file.write( sLine .. "\n" )
|
||||||
@ -107,7 +107,7 @@ local function save( _sPath )
|
|||||||
if file then
|
if file then
|
||||||
file.close()
|
file.close()
|
||||||
end
|
end
|
||||||
return ok, err
|
return ok, err, fileerr
|
||||||
end
|
end
|
||||||
|
|
||||||
local tKeywords = {
|
local tKeywords = {
|
||||||
@ -287,11 +287,15 @@ local tMenuFuncs = {
|
|||||||
if bReadOnly then
|
if bReadOnly then
|
||||||
sStatus = "Access denied"
|
sStatus = "Access denied"
|
||||||
else
|
else
|
||||||
local ok, err = save( sPath )
|
local ok, err, fileerr = save( sPath )
|
||||||
if ok then
|
if ok then
|
||||||
sStatus="Saved to "..sPath
|
sStatus="Saved to "..sPath
|
||||||
else
|
else
|
||||||
sStatus="Error saving to "..sPath
|
if fileerr then
|
||||||
|
sStatus="Error saving to "..fileerr
|
||||||
|
else
|
||||||
|
sStatus="Error saving to "..sPath
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
redrawMenu()
|
redrawMenu()
|
||||||
@ -770,3 +774,4 @@ end
|
|||||||
term.clear()
|
term.clear()
|
||||||
term.setCursorBlink( false )
|
term.setCursorBlink( false )
|
||||||
term.setCursorPos( 1, 1 )
|
term.setCursorPos( 1, 1 )
|
||||||
|
|
||||||
|
@ -128,9 +128,9 @@ local function save(path)
|
|||||||
fs.makeDir(sDir)
|
fs.makeDir(sDir)
|
||||||
end
|
end
|
||||||
|
|
||||||
local file = fs.open( path, "w" )
|
local file, err = fs.open( path, "w" )
|
||||||
if not file then
|
if not file then
|
||||||
return false
|
return false, err
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Encode (and trim)
|
-- Encode (and trim)
|
||||||
@ -313,11 +313,15 @@ local function accessMenu()
|
|||||||
fMessage = "Access denied"
|
fMessage = "Access denied"
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
local success = save(sPath)
|
local success, err = save(sPath)
|
||||||
if success then
|
if success then
|
||||||
fMessage = "Saved to "..sPath
|
fMessage = "Saved to "..sPath
|
||||||
else
|
else
|
||||||
fMessage = "Error saving to "..sPath
|
if err then
|
||||||
|
fMessage = "Error saving to "..err
|
||||||
|
else
|
||||||
|
fMessage = "Error saving to "..sPath
|
||||||
|
end
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
elseif mChoices[selection]=="Exit" then
|
elseif mChoices[selection]=="Exit" then
|
||||||
@ -401,3 +405,4 @@ term.setBackgroundColour(colours.black)
|
|||||||
term.setTextColour(colours.white)
|
term.setTextColour(colours.white)
|
||||||
term.clear()
|
term.clear()
|
||||||
term.setCursorPos(1,1)
|
term.setCursorPos(1,1)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user