[latex3-commits] [git/LaTeX3-latex3-latex3] master: Trim spaces surrounding file names (386ae8be6)

Joseph Wright joseph.wright at morningstar2.co.uk
Sun Oct 20 14:52:14 CEST 2019


Repository : https://github.com/latex3/latex3
On branch  : master
Link       : https://github.com/latex3/latex3/commit/386ae8be65d7a07ee97f0d1a89718c67601ecb46

>---------------------------------------------------------------

commit 386ae8be65d7a07ee97f0d1a89718c67601ecb46
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Sun Oct 20 13:52:14 2019 +0100

    Trim spaces surrounding file names
    
    Windows ignores spaces at the end of an extension,
    and does not allow creation of files starting with a space
    from the GUI. As such, this change gives us the
    best chance to have consistent cross-platform
    behaviour.


>---------------------------------------------------------------

386ae8be65d7a07ee97f0d1a89718c67601ecb46
 l3kernel/CHANGELOG.md |  1 +
 l3kernel/l3file.dtx   | 12 ++++++++++--
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/l3kernel/CHANGELOG.md b/l3kernel/CHANGELOG.md
index 1d2846ae8..c25f742d5 100644
--- a/l3kernel/CHANGELOG.md
+++ b/l3kernel/CHANGELOG.md
@@ -15,6 +15,7 @@ this project uses date-based 'snapshot' version identifiers.
 
 - Better coverage of (u)pTeX primitives following publication of
   pTeX manual in English
+- Trim spaces surrounding file names
 
 ### Removed
 
diff --git a/l3kernel/l3file.dtx b/l3kernel/l3file.dtx
index 6f39937f8..1157adbbb 100644
--- a/l3kernel/l3file.dtx
+++ b/l3kernel/l3file.dtx
@@ -69,6 +69,11 @@
 % using |"| tokens if they contain spaces: as a result, |"| tokens are
 % \emph{not} permitted in file names.
 %
+% Spaces are trimmed at the beginning and end of the filename \emph{as given}:
+% this reflects the fact that some file systems do not allow or interact
+% unpredictably with spaces in these positions. When no extension is given,
+% this will trim spaces from the \enquote{stem} of the file name.
+%
 % \section{Input--output stream management}
 %
 % As \TeX{} engines have a limited number of input and output streams, direct
@@ -2369,8 +2374,11 @@
 %    \begin{macrocode}
 \cs_new:Npn \__kernel_file_name_sanitize:n #1
   {
-    \__kernel_file_name_expand_loop:w #1
-      \q_recursion_tail \q_recursion_stop
+    \exp_args:Ne \tl_trim_spaces:n
+      {
+        \__kernel_file_name_expand_loop:w #1
+          \q_recursion_tail \q_recursion_stop
+      }
   }
 \cs_new:Npn \__kernel_file_name_expand_loop:w #1 \q_recursion_stop
   {





More information about the latex3-commits mailing list