Hello all, while working on my ebook, I found the following issues in mtx-epub.lua. Once a successful run is done, there is no need to try the other zippers. It also gives error messages, although everything is already done. Fix is attached. Then, I got confused about the error messages appearing 3 times and found an issue in texlua of TL2011 (beta-0.70.1-2011062107) as well as the newest standalone (beta-0.70.2-2012052309). Consider the following example: print(os.execute("abcxyz")) This gives in Lua 5.2: sh: abcxyz: command not found nil exit 127 But in texlua it does: sh: abcxyz: command not found 32512 This breaks the if conditional which becomes true, although there is no abcxyz command. If there are if statements such as this one in other places, they would not work as intended either. Andy 274,279c274,281 < if os.execute(format(zipper.uncompressed,epubfile,"mimetype")) then < os.execute(format(zipper.compressed,epubfile,"META-INF")) < os.execute(format(zipper.compressed,epubfile,"OPS")) < done = zipper.name < else < list[#list+1] = zipper.name ---
if not done then if os.execute(format(zipper.uncompressed,epubfile,"mimetype")) then os.execute(format(zipper.compressed,epubfile,"META-INF")) os.execute(format(zipper.compressed,epubfile,"OPS")) done = zipper.name else list[#list+1] = zipper.name end
On 4-6-2012 23:58, Andy Thomas wrote:
274,279c274,281 < if os.execute(format(zipper.uncompressed,epubfile,"mimetype")) then < os.execute(format(zipper.compressed,epubfile,"META-INF")) < os.execute(format(zipper.compressed,epubfile,"OPS")) < done = zipper.name < else < list[#list+1] = zipper.name ---
if not done then if os.execute(format(zipper.uncompressed,epubfile,"mimetype")) then os.execute(format(zipper.compressed,epubfile,"META-INF")) os.execute(format(zipper.compressed,epubfile,"OPS")) done = zipper.name else list[#list+1] = zipper.name end
As we give a list of zippers on failure, the following might be better: local done = false for i=1,#zippers do local zipper = zippers[i] if os.execute(format(zipper.uncompressed,epubfile,"mimetype")) then os.execute(format(zipper.compressed,epubfile,"META-INF")) os.execute(format(zipper.compressed,epubfile,"OPS")) done = zipper.name break end end lfs.chdir("..") if done then application.report("epub archive made using %s: %s",done,file.join(epubpath,epubfile)) else local list = { } for i=1,#zippers do list[#list+1] = zipper.name end application.report("no epub archive made, install one of: %s",concat(list," ")) end (I will look into the os.execute later .. remind me if needed.) Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
participants (2)
-
Andy Thomas
-
Hans Hagen