Better handle failure to open output file
This commit is contained in:
parent
d27e19a251
commit
5df4d5dd84
@ -165,7 +165,11 @@ local pdfmeta = {
|
|||||||
}
|
}
|
||||||
pdfmeta.__index = pdfmeta
|
pdfmeta.__index = pdfmeta
|
||||||
local function open(filename)
|
local function open(filename)
|
||||||
local file = io.open(filename, 'wb')
|
local file, msg = io.open(filename, 'wb')
|
||||||
|
if not file then
|
||||||
|
tex.error('Unable to open output file', string.format("Opening the output file %q failed. According to your system, the reason is: %q. If you continue, all output will be discarded.", filename, msg))
|
||||||
|
file = assert(io.tmpfile())
|
||||||
|
end
|
||||||
file:write"%PDF-X.X\n%\xC1\xAC\xC1\xB4\n"
|
file:write"%PDF-X.X\n%\xC1\xAC\xC1\xB4\n"
|
||||||
return setmetatable({file = file, version = '1.7', [0] = 0, pages = {}, objstream = {}}, pdfmeta)
|
return setmetatable({file = file, version = '1.7', [0] = 0, pages = {}, objstream = {}}, pdfmeta)
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user