[luatex] getting --output-directory
Reinhard Kotucha
reinhard.kotucha at web.de
Mon May 6 09:19:22 CEST 2013
On 2013-04-30 at 18:45:36 +0200, Stephan Hennig wrote:
> Am 29.04.2013 19:12, schrieb Stephan Hennig:
>
> > Shouldn't io.read and io.write operate in the output directory
> > instead of the current directory in the first place?
>
> Or rather io.open and io.popen.
>
> > Does this reasoning make any sense?
I don't think so. There might be reasons to set --output-directory in
order to put the PDF file somewhere else than other files.
If you want to read/write other files from/to the directory specified
by --output-directory, it's easy enough to determine the argument of
--output-directory in Lua.
\documentclass{minimal}
\usepackage{luacode}
\begin{luacode*}
for k,v in pairs(arg) do
if v:find('%-output%-directory') then
if v:find('%-output%-directory=') then
outputdir=string.explode(v, '=')[2]
else
outputdir=arg[tonumber(k)+1]
end
end
end
if outputdir and lfs.isdir(outputdir) then
texio.write_nl(outputdir..'\n')
end
\end{luacode*}
\begin{document}
\end{document}
But if you create a file, process it by an external tool, and read the
resulting file, it would be quite annoying if read and write
operations take place in different directories. Thus I think that the
current behavior is appropriate and less confusing.
And even if Taco agrees more with you than with me, it would be very
helpful at least to have a boolean variable 'luaoutputdirectory' which
allows to control the behavior.
Regards,
Reinhard
--
----------------------------------------------------------------------------
Reinhard Kotucha Phone: +49-511-3373112
Marschnerstr. 25
D-30167 Hannover mailto:reinhard.kotucha at web.de
----------------------------------------------------------------------------
Microsoft isn't the answer. Microsoft is the question, and the answer is NO.
----------------------------------------------------------------------------
More information about the luatex
mailing list