Skip to content

Commit

Permalink
Allow for optional "/" at end of \input@path
Browse files Browse the repository at this point in the history
  • Loading branch information
josephwright committed May 29, 2023
1 parent 1e30a0c commit cb8ef86
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 5 deletions.
2 changes: 2 additions & 0 deletions l3kernel/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ this project uses date-based 'snapshot' version identifiers.
- Set `\l_keys_value_tl` in `.initial:n` (issue \#1013)
- Support for boolean values in `expl3` package options
`check-declarations` and `log-functions` (issue \#978)
- Allow for optional `/` at end of `\input@path` entries
(see latex3/latex2e\#1076)

## [2023-05-22]

Expand Down
36 changes: 31 additions & 5 deletions l3kernel/l3file.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -2873,7 +2873,9 @@
%
% \begin{macro}[EXP]{\file_full_name:n, \@@_full_name:n, \@@_full_name_aux:n}
% \begin{macro}[EXP]{\@@_full_name_auxi:nn, \@@_full_name_auxii:nn}
% \begin{macro}[EXP]{\@@_full_name_aux:Nnnn}
% \begin{macro}[EXP]{\@@_full_name_aux:Nnn}
% \begin{macro}[EXP]{\@@_full_name_slash:n}
% \begin{macro}[EXP]{\@@_full_name_slash:w}
% \begin{macro}[EXP]{\@@_full_name_aux:nN}
% \begin{macro}[EXP]{\@@_full_name_aux:nnN}
% \begin{macro}[EXP]{\@@_name_cleanup:w}
Expand Down Expand Up @@ -2943,11 +2945,11 @@
\tl_if_blank:nTF {#2}
{
\seq_map_tokens:Nn \l_file_search_path_seq
{ \@@_full_name_aux:Nnnn \seq_map_break:n {#1} { / } }
{ \@@_full_name_aux:Nnn \seq_map_break:n {#1} }
\cs_if_exist:NT \input@path
{
\tl_map_tokens:Nn \input@path
{ \@@_full_name_aux:Nnnn \tl_map_break:n {#1} { } }
{ \@@_full_name_aux:Nnn \tl_map_break:n {#1} }
}
\@@_name_end:
}
Expand All @@ -2957,8 +2959,30 @@
% Two pars to the auxiliary here so we can avoid doing quoting
% twice in the event we find the right file.
% \begin{macrocode}
\cs_new:Npn \@@_full_name_aux:Nnnn #1#2#3#4
{ \exp_args:Ne \@@_full_name_aux:nN { \tl_to_str:n {#4} #3 #2 } #1 }
\cs_new:Npn \@@_full_name_aux:Nnn #1#2#3
{
\exp_args:Ne \@@_full_name_aux:nN
{
\exp_args:Ne \@@_full_name_slash:n
{ \tl_to_str:n {#3} } #2
}
#1
}
\cs_new:Npn \@@_full_name_slash:n #1
{
\@@_full_name_slash:nw { } #1 / \q_nil / \q_stop
}
\cs_new:Npn \@@_full_name_slash:nw #1#2 / #3 / #4 \q_stop
{
\quark_if_nil:nTF {#3}
{ #1#2 / }
{
\tl_if_blank:nTF {#3}
{ \@@_full_name_slash:nw {#1#2} }
{ \@@_full_name_slash:nw { #1#2 / #3 } }
/ #4 \q_stop
}
}
\cs_new:Npn \@@_full_name_aux:nN #1
{ \exp_args:Nne \@@_full_name_aux:nnN {#1} { \@@_full_name_aux:n {#1} } }
\cs_new:Npn \@@_full_name_aux:nnN #1 #2 #3
Expand Down Expand Up @@ -3026,6 +3050,8 @@
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\file_get_full_name:nN, \file_get_full_name:VN}
% \begin{macro}[TF]{\file_get_full_name:nN, \file_get_full_name:VN}
Expand Down
4 changes: 4 additions & 0 deletions l3kernel/testfiles/m3file001.lvt
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@
\cs_set:cpn { input@path } { { ./testpath/ } }
\TYPE { 2e:~\file_full_name:n { infolder.txt } }
\group_end:
\group_begin:
\cs_set:cpn { input@path } { { ./testpath } }
\TYPE { Slashes:~\file_full_name:n { infolder.txt } }
\group_end:
}

\TEST { Getting~the~full~name~of~files }
Expand Down
1 change: 1 addition & 0 deletions l3kernel/testfiles/m3file001.tlg
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ TEST 3: Find files in the search path
============================================================
l3: ./testpath/infolder.txt
2e: ./testpath/infolder.txt
Slashes: ./testpath/infolder.txt
============================================================
============================================================
TEST 4: Getting the full name of files
Expand Down

0 comments on commit cb8ef86

Please sign in to comment.