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.dtx93
1 files changed, 61 insertions, 32 deletions
diff --git a/macros/latex-dev/base/ltfiles.dtx b/macros/latex-dev/base/ltfiles.dtx
index afb085a417..7c43abc079 100644
--- a/macros/latex-dev/base/ltfiles.dtx
+++ b/macros/latex-dev/base/ltfiles.dtx
@@ -32,7 +32,7 @@
%<*driver>
% \fi
\ProvidesFile{ltfiles.dtx}
- [2019/08/27 v1.2b LaTeX Kernel (File Handling)]
+ [2019/11/11 v1.2f LaTeX Kernel (File Handling)]
% \iffalse
\documentclass{ltxdoc}
\GetFileInfo{ltfiles.dtx}
@@ -706,7 +706,16 @@
% A side effect of the new code is that we will see quotes around
% file name displays where there haven't been any before.
%
+% For compatibilty with existing code using |{abc}.tex| or |{one.two}.png|
+% an initial brace group is discarded before expansion and |\string| is applied
+% The content of the brace group is discarded. This means that a leading space
+% will be lost unless protected (by |{ }| or |" "| or |\space|) but filenames
+% with a space are hopefully rare.
+%
% \changes{v1.2a}{2019/07/01}{Support UTF-8}
+% \changes{v1.2c}{2019/10/11}{Remove one brace group}
+% \changes{v1.2d}{2019/10/26}{remove quotes}
+% \changes{v1.2e}{2019/11/09}{expand and \cs{string} before removing quotes}
% \begin{macrocode}
%</2ekernel>
%<*2ekernel|latexrelease>
@@ -715,7 +724,11 @@
\def\set@curr@file#1{%
\begingroup
\escapechar\m@ne
- \xdef\@curr@file{\expandafter\string\csname #1\endcsname}%
+ \xdef\@curr@file{%
+ \expandafter\expandafter\expandafter\unquote@name
+ \expandafter\expandafter\expandafter{%
+ \expandafter\string
+ \csname\@firstofone#1\@empty\endcsname}}%
\endgroup
}
% \end{macrocode}
@@ -751,11 +764,11 @@
%
% \changes{v1.2a}{2019/07/01}{Support UTF-8}
% \changes{v1.2b}{2019/08/27}{Make command robust}
+% \changes{v1.2d}{2019/10/26}{dont quote name}
% \begin{macrocode}
\DeclareRobustCommand\IfFileExists[1]{%
\set@curr@file{#1}%
- \edef\q@curr@file{\expandafter\quote@name\expandafter{\@curr@file}}%
- \expandafter\IfFileExists@\expandafter{\q@curr@file}}
+ \expandafter\IfFileExists@\expandafter{\@curr@file}}
% \end{macrocode}
% \end{macro}
%
@@ -763,10 +776,11 @@
% \changes{v0.9b}{1993/12/04}{Macro added}
% \changes{v0.9p}{1994/01/18}{New Definition}
% \changes{v1.0t}{1995/05/25}{(CAR) added \cs{long}}
-%
+% \changes{v1.2d}{2019/10/26}{quote on openin}%
+% Argument |#1| is |\@curr@file| so catcode 12 string with no quotes.
% \begin{macrocode}
\long\def \IfFileExists@#1#2#3{%
- \openin\@inputcheck#1 %
+ \openin\@inputcheck"#1" %
\ifeof\@inputcheck
\ifx\input@path\@undefined
\def\reserved@a{#3}%
@@ -775,13 +789,40 @@
\fi
\else
\closein\@inputcheck
- \edef\@filef@und{#1 }%
+ \edef\@filef@und{"#1" }%
\def\reserved@a{#2}%
\fi
\reserved@a}
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\@iffileonpath}
+% If the file is not found by |\openin|, and |\input@path| is defined,
+% look in all the directories specified in |\input@path|.
+% \changes{v0.9p}{1994/01/18}{Macro added}
+% \changes{v1.0f}{1994/05/02}
+% {\cs{@break@loop} renamed to \cs{@break@tfor}}
+% \changes{v1.0t}{1995/05/25}
+% {(CAR) added \cs{long}}
+% \changes{v1.1d}{1996/01/10}
+% {Change argument handling to not require doubled hash. latex/2024}
+% \changes{v1.2d}{2019/10/26}{quote on openin}%
+% \changes{v1.2f}{2019/11/11}{make \cs{@filef@und} match quoting used on \cs{openin}}%
+% \begin{macrocode}
+\long\def\@iffileonpath#1{%
+ \let\reserved@a\@secondoftwo
+ \expandafter\@tfor\expandafter\reserved@b\expandafter
+ :\expandafter=\input@path\do{%
+ \openin\@inputcheck\expandafter\quote@name\expandafter{\reserved@b#1} %
+ \ifeof\@inputcheck\else
+ \edef\@filef@und{\expandafter\quote@name\expandafter{\reserved@b#1} }%
+ \let\reserved@a\@firstoftwo%
+ \closein\@inputcheck
+ \@break@tfor
+ \fi}%
+ \reserved@a}
+% \end{macrocode}
+% \end{macro}
%
% \begin{macrocode}
%</2ekernel|latexrelease>
@@ -811,37 +852,25 @@
%<latexrelease> \fi
%<latexrelease> \reserved@a}
%<latexrelease>
+%<latexrelease>\long\def\@iffileonpath#1{%
+%<latexrelease> \let\reserved@a\@secondoftwo
+%<latexrelease> \expandafter\@tfor\expandafter\reserved@b\expandafter
+%<latexrelease> :\expandafter=\input@path\do{%
+%<latexrelease> \openin\@inputcheck\reserved@b#1 %
+%<latexrelease> \ifeof\@inputcheck\else
+%<latexrelease> \edef\@filef@und{\reserved@b#1 }%
+%<latexrelease> \let\reserved@a\@firstoftwo%
+%<latexrelease> \closein\@inputcheck
+%<latexrelease> \@break@tfor
+%<latexrelease> \fi}%
+%<latexrelease> \reserved@a}
+%<latexrelease>
%<latexrelease>\EndIncludeInRelease
%<*2ekernel>
% \end{macrocode}
%
%
%
-% \begin{macro}{\@iffileonpath}
-% If the file is not found by |\openin|, and |\input@path| is defined,
-% look in all the directories specified in |\input@path|.
-% \changes{v0.9p}{1994/01/18}{Macro added}
-% \changes{v1.0f}{1994/05/02}
-% {\cs{@break@loop} renamed to \cs{@break@tfor}}
-% \changes{v1.0t}{1995/05/25}
-% {(CAR) added \cs{long}}
-% \changes{v1.1d}{1996/01/10}
-% {Change argument handling to not require doubled hash. latex/2024}
-% \begin{macrocode}
-\long\def\@iffileonpath#1{%
- \let\reserved@a\@secondoftwo
- \expandafter\@tfor\expandafter\reserved@b\expandafter
- :\expandafter=\input@path\do{%
- \openin\@inputcheck\reserved@b#1 %
- \ifeof\@inputcheck\else
- \edef\@filef@und{\reserved@b#1 }%
- \let\reserved@a\@firstoftwo%
- \closein\@inputcheck
- \@break@tfor
- \fi}%
- \reserved@a}
-% \end{macrocode}
-% \end{macro}
%
% \begin{macro}{\InputIfFileExists}
% \changes{v0.9b}