summaryrefslogtreecommitdiff
path: root/support/tex4ebook/tex4ebook-exec_azw.lua
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2021-10-01 03:01:47 +0000
committerNorbert Preining <norbert@preining.info>2021-10-01 03:01:47 +0000
commit569e4d488d3398f8ed12807dd67e2b301b7447d5 (patch)
treeb0649aad82d5811ce9251e770edd9a1c94b71f0f /support/tex4ebook/tex4ebook-exec_azw.lua
parentc0e66330261a0098e8041d4cc1428666ef598c30 (diff)
CTAN sync 202110010301
Diffstat (limited to 'support/tex4ebook/tex4ebook-exec_azw.lua')
-rw-r--r--support/tex4ebook/tex4ebook-exec_azw.lua17
1 files changed, 10 insertions, 7 deletions
diff --git a/support/tex4ebook/tex4ebook-exec_azw.lua b/support/tex4ebook/tex4ebook-exec_azw.lua
index 397292b648..ebf8d34144 100644
--- a/support/tex4ebook/tex4ebook-exec_azw.lua
+++ b/support/tex4ebook/tex4ebook-exec_azw.lua
@@ -1,5 +1,6 @@
module(...,package.seeall)
local eb = require("tex4ebook-exec_epub")
+local mobi = require("tex4ebook-exec_mobi")
local ebookutils = require("mkutils")
local log = logging.new "exec_azw"
@@ -19,13 +20,15 @@ function writeContainer()
-- find the azw filename
local azwfile = eb.outputfile:gsub("epub$", "azw")
local azwdist = eb.destdir .. azwfile
- local command = "kindlegen " .. epubpath .. " -o " .. azwfile
- log:info("Pack azw ".. command)
- local status, output = ebookutils.execute(command)
- -- copy the azw 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(eb.basedir .. "/" .. azwfile, azwdist)
+ local status = mobi.kindlegen(epubpath, azwfile)
+ if status then
+ -- copy the azw 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
+ if azwfile ~= azwdist then
+ ebookutils.cp(azwfile, azwdist)
+ end
+ end
return ret
end