summaryrefslogtreecommitdiff
path: root/macros/latex-dev/base/ltfiles.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex-dev/base/ltfiles.dtx')
-rw-r--r--macros/latex-dev/base/ltfiles.dtx26
1 files changed, 21 insertions, 5 deletions
diff --git a/macros/latex-dev/base/ltfiles.dtx b/macros/latex-dev/base/ltfiles.dtx
index 3bac7ea0b2..f079c2cf5b 100644
--- a/macros/latex-dev/base/ltfiles.dtx
+++ b/macros/latex-dev/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
@@ -1224,7 +1225,7 @@
% \begin{macrocode}
%</2ekernel>
%<*2ekernel|latexrelease>
-%<latexrelease>\IncludeInRelease{2023/05/01}%
+%<latexrelease>\IncludeInRelease{2023/06/01}%
%<latexrelease> {\IfFileExists@}{IfFileExists}
\long\def \IfFileExists@#1#2#3{%
\edef\@filef@und{\IfFileExists@@{#1}}%
@@ -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