diff options
Diffstat (limited to 'Master/texmf-dist/scripts/tex4ebook/exec_mobi.lua')
-rwxr-xr-x | Master/texmf-dist/scripts/tex4ebook/exec_mobi.lua | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/Master/texmf-dist/scripts/tex4ebook/exec_mobi.lua b/Master/texmf-dist/scripts/tex4ebook/exec_mobi.lua index be9148b5a10..11871ade769 100755 --- a/Master/texmf-dist/scripts/tex4ebook/exec_mobi.lua +++ b/Master/texmf-dist/scripts/tex4ebook/exec_mobi.lua @@ -1,5 +1,6 @@ module(...,package.seeall) local eb = require("exec_epub") +local ebookutils = require("mkutils") function prepare(params) return eb.prepare(params) @@ -11,7 +12,17 @@ end function writeContainer() local ret = eb.writeContainer() - print("Pack mobi "..os.execute("kindlegen " .. eb.outputfile)) + -- convert the epub file to mobi + local epubpath = eb.basedir .. "/" .. eb.outputfile + print("Pack mobi "..os.execute("kindlegen " .. epubpath)) + -- find the mobi filename + local mobifile = epubpath:gsub("epub$", "mobi") + local mobidist = eb.destdir .. eb.outputfile:gsub("epub$", "mobi") + -- copy the mobi file to the destination directory + -- the destination directory will be created by the epub writer, so it is possible to use + -- the cp function which doesn't try to create directory + ebookutils.cp(mobifile, mobidist) + return ret end |