summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts/tex4ebook/exec_mobi.lua
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-01-10 22:21:28 +0000
committerKarl Berry <karl@freefriends.org>2019-01-10 22:21:28 +0000
commit0446755d9f93d095627779097695fa3468811b93 (patch)
tree31b8f58994f6d3c32a58fb54e238ee0472646543 /Master/texmf-dist/scripts/tex4ebook/exec_mobi.lua
parent8368bb1a1e80c128b441a121a8fda08f0e32d5ae (diff)
tex4ebook (10jan19)
git-svn-id: svn://tug.org/texlive/trunk@49665 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts/tex4ebook/exec_mobi.lua')
-rwxr-xr-xMaster/texmf-dist/scripts/tex4ebook/exec_mobi.lua13
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