- eliminati ritorni errore con falso che impallavano il programma
- gestita lettura file di errore se generato e restituzione testo errore
This commit is contained in:
+51
-10
@@ -188,8 +188,9 @@ local function Calc_WindowHardware( nManufacturer, QuestionArgs)
|
||||
-- Apro file Input in scrittura
|
||||
local fhInput = io.open( sInputFile, 'w')
|
||||
if not fhInput then
|
||||
EgtOutLog( 'Error opening file ' .. sInputFile)
|
||||
return false
|
||||
local sErrorMsg = 'Error opening file ' .. sInputFile
|
||||
EgtOutLog(sErrorMsg)
|
||||
return 0, { Error = sErrorMsg}
|
||||
end
|
||||
|
||||
local ReturnMode = tonumber( QuestionArgs['ReturnMode'])
|
||||
@@ -238,8 +239,18 @@ local function Calc_WindowHardware( nManufacturer, QuestionArgs)
|
||||
-- Apro file OptionList in lettura
|
||||
local fhOptionList = io.open( sInputOptionFile, 'r')
|
||||
if not fhOptionList then
|
||||
EgtOutLog( 'Error opening file ' .. sInputOptionFile)
|
||||
return false
|
||||
local sErrorInputOptionFile = EgtChangePathExtension( sInputOptionFile, '.err')
|
||||
local fhHardwareOptionListError = io.open( sErrorInputOptionFile, 'r')
|
||||
if not fhHardwareOptionListError then
|
||||
local sErrorMsg = 'Error opening file ' .. sInputOptionFile
|
||||
EgtOutLog(sErrorMsg)
|
||||
return 0, { Error = sErrorMsg}
|
||||
else
|
||||
local sErrorMsg = 'Error opening file ' .. sInputOptionFile .. '\n' .. fhHardwareOptionListError:read('*a')
|
||||
fhHardwareOptionListError:close()
|
||||
EgtOutLog(sErrorMsg)
|
||||
return 0, { Error = sErrorMsg}
|
||||
end
|
||||
end
|
||||
OptionList = fhOptionList:read('*a')
|
||||
-- Chiudo file OutputKit in lettura
|
||||
@@ -262,8 +273,18 @@ local function Calc_WindowHardware( nManufacturer, QuestionArgs)
|
||||
-- Apro file OptionList in lettura
|
||||
local fhHardwareList = io.open( sOutputKitFile, 'r')
|
||||
if not fhHardwareList then
|
||||
EgtOutLog( 'Error opening file ' .. sOutputKitFile)
|
||||
return false
|
||||
local sErrorOutputKitFile = EgtChangePathExtension( sOutputKitFile, '.err')
|
||||
local fhHardwareListError = io.open( sErrorOutputKitFile, 'r')
|
||||
if not fhHardwareListError then
|
||||
local sErrorMsg = 'Error opening file ' .. sOutputKitFile
|
||||
EgtOutLog(sErrorMsg)
|
||||
return 0, { Error = sErrorMsg}
|
||||
else
|
||||
local sErrorMsg = 'Error opening file ' .. sOutputKitFile .. '\n' .. fhHardwareListError:read('*a')
|
||||
fhHardwareListError:close()
|
||||
EgtOutLog(sErrorMsg)
|
||||
return 0, { Error = sErrorMsg}
|
||||
end
|
||||
end
|
||||
local nHardwareLineIndex = 1
|
||||
for sLine in fhHardwareList:lines('l') do
|
||||
@@ -294,8 +315,18 @@ local function Calc_WindowHardware( nManufacturer, QuestionArgs)
|
||||
-- Apro file OptionList in lettura
|
||||
local fhMachiningList = io.open( sOutputMachiningFile, 'r')
|
||||
if not fhMachiningList then
|
||||
EgtOutLog( 'Error opening file ' .. sOutputMachiningFile)
|
||||
return false
|
||||
local sErrorOutputMachiningFile = EgtChangePathExtension( sOutputMachiningFile, '.err')
|
||||
local fhMachiningListError = io.open( sErrorOutputMachiningFile, 'r')
|
||||
if not fhMachiningListError then
|
||||
local sErrorMsg = 'Error opening file ' .. sOutputMachiningFile
|
||||
EgtOutLog(sErrorMsg)
|
||||
return 0, { Error = sErrorMsg}
|
||||
else
|
||||
local sErrorMsg = 'Error opening file ' .. sOutputMachiningFile .. '\n' .. fhMachiningListError:read('*a')
|
||||
fhMachiningListError:close()
|
||||
EgtOutLog(sErrorMsg)
|
||||
return 0, { Error = sErrorMsg}
|
||||
end
|
||||
end
|
||||
local nMachiningLineIndex = 1
|
||||
for sLine in fhMachiningList:lines('l') do
|
||||
@@ -329,8 +360,18 @@ local function Calc_WindowHardware( nManufacturer, QuestionArgs)
|
||||
-- Apro file OptionList in lettura
|
||||
local fhPositionList = io.open( sOutputPositionFile, 'r')
|
||||
if not fhPositionList then
|
||||
EgtOutLog( 'Error opening file ' .. sOutputPositionFile)
|
||||
return false
|
||||
local sErrorOutputPositionFile = EgtChangePathExtension( sOutputPositionFile, '.err')
|
||||
local fhHardwarePositionListError = io.open( sErrorOutputPositionFile, 'r')
|
||||
if not fhHardwarePositionListError then
|
||||
local sErrorMsg = 'Error opening file ' .. sOutputPositionFile
|
||||
EgtOutLog(sErrorMsg)
|
||||
return 0, { Error = sErrorMsg}
|
||||
else
|
||||
local sErrorMsg = 'Error opening file ' .. sOutputPositionFile .. '\n' .. fhHardwarePositionListError:read('*a')
|
||||
fhHardwarePositionListError:close()
|
||||
EgtOutLog(sErrorMsg)
|
||||
return 0, { Error = sErrorMsg}
|
||||
end
|
||||
end
|
||||
local nPositionLineIndex = 1
|
||||
for sLine in fhPositionList:lines('l') do
|
||||
|
||||
Reference in New Issue
Block a user