[luatex] getting --output-directory

Stephan Hennig mailing_list at arcor.de
Mon Apr 29 19:12:18 CEST 2013


Am 26.04.2013 18:19, schrieb Stephan Hennig:

> I want to read from and write to a particular file in --output-directory
> or in the current directory, if option --output-directory is not used.
> 
> What is the preferred way in Lua to get the path set via option
> --output-directory?  Is there an alternative to scanning table arg for
> that option?

Toying a bit with scanning arg, this approach doesn't seem right.
(Lua)TeX understands a variety of option syntaxes, like

  -output-directory=<dir>
  -output-directory <dir>
  --output-directory=<dir>
  --output-directory <dir>

And guess what

  luatex --output-directory= --safer <file>

does?  It writes files to the root directory.  Seems plausible, since
appending / to the empty string (which doesn't end with a slash already)
results in just /.  But

  --output-directory=

is not the same as

  --output-directory=/

At least not in the msysgit bash shell (on Windows), where the former
option writes to the root directory, but the latter to the msysgit
installation directory instead.

So, there seems to be a sophisticated mechanism implemented in (Lua)TeX
for parsing --output-directory and determining the actual output
directory.  It doesn't make sense to re-implement that in Lua just to
obey option --output-directory when reading and writing files from Lua.

Would it be possible to provide means to easily determine the output
directory in LuaTeX, e.g., make it available in one of the status, tex
or texconfig tables?

Giving this another thought, should a user have to mess with the output
directory at all?  Shouldn't io.read and io.write operate in the output
directory instead of the current directory in the first place?  Does
this reasoning make any sense?

Best regards,
Stephan Hennig



More information about the luatex mailing list