Strip trailing \r's also for first and last line
parent
28bc9ef07f
commit
d4593491ef
|
@ -205,6 +205,8 @@ end
|
||||||
-- config: see above
|
-- config: see above
|
||||||
local function read_from_fd(file)
|
local function read_from_fd(file)
|
||||||
local first_line = file:read("*line")
|
local first_line = file:read("*line")
|
||||||
|
-- possibly windows fix: strip trailing \r's from line
|
||||||
|
first_line = string.gsub(first_line, "\r$", "")
|
||||||
if not string.match(first_line, "LUA_SER v=[12]") then
|
if not string.match(first_line, "LUA_SER v=[12]") then
|
||||||
file:close()
|
file:close()
|
||||||
error("Expected header, got '"..first_line.."' instead!")
|
error("Expected header, got '"..first_line.."' instead!")
|
||||||
|
@ -212,6 +214,8 @@ local function read_from_fd(file)
|
||||||
local t = {}
|
local t = {}
|
||||||
read_table(t, file)
|
read_table(t, file)
|
||||||
local last_line = file:read("*line")
|
local last_line = file:read("*line")
|
||||||
|
-- possibly windows fix: strip trailing \r's from line
|
||||||
|
last_line = string.gsub(last_line, "\r$", "")
|
||||||
file:close()
|
file:close()
|
||||||
if last_line ~= "END_SER" then
|
if last_line ~= "END_SER" then
|
||||||
error("Missing END_SER, got '"..last_line.."' instead!")
|
error("Missing END_SER, got '"..last_line.."' instead!")
|
||||||
|
|
Loading…
Reference in New Issue