Many languages provide functions to obtain the absolute path of a file. I wonder if Tex/LaTex has also such macros.
In the following example, given a file name, test if this file really exists. Then, if yes, output its absolute path(including file name) from root like /home/foo/bar/myfile or /c/Program Files/foo/bar/myfile.tex.
Example:
\documentclass{article} \ExplSyntaxOn \NewDocumentCommand\getabsolutepath{m}{ \file_if_exist:nTF {#1} { % output the absolute path of the file name #1 } {do some other things} } \ExplSyntaxOff \begin{document} % Given that the current path names "cp". A file named "a.tex" locates in its subdirectory "sub". % The typesets of the following invokations of \getabsolutepath should be absolutely the same when file "a" really exists because they refer to the same file. \getabsolutepath{sub/a} \getabsolutepath{./sub/a} \getabsolutepath{./sub/a.tex} \getabsolutepath{../cp/sub/a} \end{document} 
\input...and so on. What I want is just giving a file name and obtain its absolute path from root if the file really exists.\CurrentFilePath