I have to check existence of file on given path.
Please, consider small example.
Two files:
dummy.tex (empty)
main.tex
main.tex:
Code: Select all
\documentclass{article}
\makeatletter
\def\IsFileExists#1{% Simple macro to check file existence
\openin\@inputcheck#1 %
\ifeof\@inputcheck
\message{File #1 -- not exists.
}
\else
\message{File #1 -- exists.
}
\fi
\closein\@inputcheck}
\makeatother
\begin{document}
\IsFileExists{dummy.tex}
\IsFileExists{../dummy.tex}
\IsFileExists{../../dummy.tex}
\end{document}
If we run
Code: Select all
latex main.tex
Code: Select all
File dummy.tex -- exists. File ../dummy.tex -- not exists.
File ../../dummy.tex -- not exists. (./main.aux) )
Code: Select all
latex -output-directory="subdir" main.tex
Code: Select all
File dummy.tex -- exists. ***** File ../dummy.tex -- exists. ***** WTF????
File ../../dummy.tex -- not exists. (subdir/main.aux) )
How can I do robust check of file existence, not depending from "-output-directory" parameter?
Thanks all in advance,
Sincerely, Stas Fomin
P.S. I use Windows TexLive distrib. Sample files attached.