diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/base/ltfiles.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/base/ltfiles.dtx | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/Master/texmf-dist/source/latex/base/ltfiles.dtx b/Master/texmf-dist/source/latex/base/ltfiles.dtx index 3bac7ea0b22..9b028241979 100644 --- a/Master/texmf-dist/source/latex/base/ltfiles.dtx +++ b/Master/texmf-dist/source/latex/base/ltfiles.dtx @@ -32,7 +32,7 @@ %<*driver> % \fi \ProvidesFile{ltfiles.dtx} - [2023/05/17 v1.2t LaTeX Kernel (File Handling)] + [2023/06/17 v1.2u LaTeX Kernel (File Handling)] % \iffalse \documentclass{ltxdoc} \GetFileInfo{ltfiles.dtx} @@ -1203,8 +1203,9 @@ % \changes{v1.2d}{2019/10/26}{quote on openin} % \changes{v1.2k}{2021/03/12}{Allow unbalanced conditionals (gh/530)} % \changes{v1.2t}{2023/05/15}{Use \pkg{expl3} file existence test} -% \begin{macro}{\IfFileExists@} +% \begin{macro}{\IfFileExists@@} % \changes{v1.2t}{2023/05/15}{Macro added} +% \changes{v1.2u}{2023/06/16}{Support piped input} % Argument |#1| is |\@curr@file| so catcode 12 string with no quotes. % % The original definition picked up arguments |#2| and |#3| in a @@ -1212,7 +1213,7 @@ % implementation would have been not to pick up the arguments at % all but instead use the usual \cs{@firstoftwo} and % \cs{secondoftwo}. However, that changes how |#| is interpreted -% and so we can't do that nowaways without invalidating a lot of +% and so we can't do that nowadays without invalidating a lot of % code. Therefore the somewhat curious construction near the end. % % Earlier versions used |\openin| here, but this led to two @@ -1251,8 +1252,23 @@ \expandafter\def\expandafter\reserved@a \expandafter{\reserved@a{#2}{#3}}% \reserved@a} +% \end{macrocode} +% Pipes are not really files, but at the document level they are supported. +% To quickly trim of any leading spaces, we use a blank test and \cs{use:n} +% rather than \cs{tl_trim_spaces:n} for speed as we don't care about the end +% of the input. +% \begin{macrocode} \ExplSyntaxOn -\cs_new_eq:NN \IfFileExists@@ \file_full_name:n +\cs_new:Npn \IfFileExists@@ #1 + { + \tl_if_blank:nF {#1} + { + \tl_if_head_eq_charcode:oNTF { \use:n #1 } | + {#1} + { \file_full_name:n {#1} } + } + } +\cs_generate_variant:Nn \tl_if_head_eq_charcode:nNTF { o } \ExplSyntaxOff %</2ekernel|latexrelease> %<latexrelease>\EndIncludeInRelease |