diff options
author | Karl Berry <karl@freefriends.org> | 2012-02-06 01:22:10 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2012-02-06 01:22:10 +0000 |
commit | 88ad42f78998b5210fa58a05e2e7750f897b2550 (patch) | |
tree | 6faffeb117d275760dd935be86714b25013bcec3 /Master/texmf-dist/tex/latex/l3kernel/l3file.sty | |
parent | 6406190e2336a4aa3036d7d8943c14c02a4ccadf (diff) |
l3kernel 3287
git-svn-id: svn://tug.org/texlive/trunk@25306 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/l3kernel/l3file.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/l3kernel/l3file.sty | 69 |
1 files changed, 64 insertions, 5 deletions
diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3file.sty b/Master/texmf-dist/tex/latex/l3kernel/l3file.sty index 2ae16bd987d..f79666e640a 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3file.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3file.sty @@ -46,7 +46,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3file.dtx 3158 2012-01-09 00:47:42Z bruno $ +\GetIdInfo$Id: l3file.dtx 3287 2012-01-31 22:08:14Z joseph $ {L3 Experimental file operations} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} @@ -60,14 +60,26 @@ \seq_new:N \l_file_internal_saved_path_seq \seq_new:N \l_file_internal_seq \ior_new:N \g_file_internal_ior -\cs_new_protected:Npn \file_add_path:nN #1#2 +\cs_new_protected:Npn \file_add_path:nN #1 { - \ior_open:Nn \g_file_internal_ior {#1} + \group_begin: + \tl_to_str_active_safe:Nx \l_file_internal_name_tl {#1} + \tl_if_in:NnT \l_file_internal_name_tl { ~ } + { + \msg_kernel_error:nnx { io } { space-in-file-name } + { \l_file_internal_name_tl } + } + \exp_args:NNo \group_end: + \file_add_path_aux:nN \l_file_internal_name_tl + } +\cs_new_protected:Npn \file_add_path_aux:nN #1#2 + { + \ior_open_unsafe:Nn \g_file_internal_ior {#1} \ior_if_eof:NTF \g_file_internal_ior { \file_add_path_search:nN {#1} #2 } { \ior_close:N \g_file_internal_ior - \tl_set:Nx #2 {#1} + \tl_set:Nn #2 {#1} } } \cs_new_protected:Npn \file_add_path_search:nN #1#2 @@ -82,7 +94,7 @@ } \seq_map_inline:Nn \l_file_search_path_seq { - \ior_open:Nn \g_file_internal_ior { ##1 #1 } + \ior_open_unsafe:Nn \g_file_internal_ior { ##1 #1 } \ior_if_eof:NF \g_file_internal_ior { \tl_set:Nx #2 { ##1 #1 } @@ -112,6 +124,53 @@ \seq_gpop:NN \g_file_stack_seq \g_file_current_name_tl } } +\cs_new_protected:Npn \file_split_path_name_ext:nNNN #1 + { + \group_begin: + \tl_to_str_active_safe:Nx \l_file_internal_name_tl {#1} + \tl_if_in:NnT \l_file_internal_name_tl { ~ } + { + \msg_kernel_error:nnx { io } { space-in-file-name } + { \l_file_internal_name_tl } + } + \exp_args:NNo \group_end: + \file_split_path_name_ext_aux:nNNN \l_file_internal_name_tl + } +\cs_new_protected:Npn \file_split_path_name_ext_aux:nNNN #1#2#3#4 + { + \tl_clear:N #2 + \tl_clear:N #3 + \file_split_path:wNNN #1 / \q_nil / \q_stop #2#3#4 + } +\cs_new_protected:Npn \file_split_path:wNNN #1 / #2 / #3 \q_stop #4 + { + \quark_if_nil:nTF {#2} + { \file_split_name_ext:wNN #1 . \q_nil . \q_stop } + { + \tl_put_right:Nn #4 { #1 / } + \file_split_path:wNNN #2 / #3 \q_stop #4 + } + } +\cs_new_protected:Npn \file_split_name_ext:wNN #1 . #2 . #3 \q_stop #4#5 + { + \quark_if_nil:nTF {#2} + { + \tl_if_empty:NTF #4 + { + \tl_set:Nn #4 {#1} + \tl_clear:N #5 + } + { \tl_set:Nn #5 {#1} } + } + { + \tl_put_right:Nx #4 + { + \tl_if_empty:NF #4 { . } + #1 + } + \file_split_name_ext:wNN #2 . #3 \q_stop #4#5 + } + } \cs_new_protected:Npn \file_path_include:n #1 { \seq_if_in:NnF \l_file_search_path_seq {#1} |