Skip to content

Commit e06767d

Browse files
committed
Media bag writing should create dir if necessary
Use the utility which takes care of this
1 parent 0cf8ba6 commit e06767d

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/resources/filters/quarto-finalize/mediabag.lua

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,12 @@ function mediabag()
1111
not _quarto.format.isPowerPointOutput() then
1212
local mt, contents = pandoc.mediabag.lookup(el.src)
1313
if contents ~= nil then
14+
1415
local mediabagDir = param("mediabag-dir", nil)
1516
local mediaFile = pandoc.path.join{mediabagDir, el.src}
16-
local file = io.open(mediaFile, "wb")
17-
if file then
18-
file:write(contents)
19-
file:close()
20-
else
17+
18+
local file = _quarto.file.write(mediaFile, contents)
19+
if not file then
2120
warn('failed to write mediabag entry: ' .. mediaFile)
2221
end
2322
el.src = mediaFile

0 commit comments

Comments
 (0)