A recent MikTeX update broke some code that I'm using. I have many files filled with filenames, the code reads these filenames, and then does some stuff with the contents of the corresponding file. The contents of each file are some combination of (1) balanced groups of text/code which is printed, or (2) filenames on which the process is repeated.
I compile with lualatex.
The issue is that since my update, files cannot be found because of an end of line character that is appended to the file extension. I could use \ior_str_map_inline: but since some of the filenames are commented, I then get file not found errors due to the % at the start of the filename. Even if those weren't commented, the combination of code and filenames in some of the files would mean that if everything were "stringified", then the code won't compile. I also tried to read as a string, and then to convert back a token list using \scantokens and \scantextokens but what I tried did not work.
Is there an easy way to make things just work again?
p.s. The filenames do indeed contain underscores.
\documentclass{article} \usepackage{xparse} \begin{filecontents*}{files.tex} file_1.tex %file_2.tex elif_3.tex \end{filecontents*} \ExplSyntaxOn \NewDocumentCommand{\getstuff}{m} { \file_if_exist:nT {#1} { \ior_open:Nn \g_tmpa_ior {#1} \ior_map_inline:Nn \g_tmpa_ior { % if a filename has been commented, then ##1 will be empty \tl_if_empty:nTF {##1} {\tl_show:n {"##1"~is~empty!}} { % check whether file exists \file_if_exist:nTF {##1} { % and branch depending on whether filename contains x \tl_if_in:nnTF {##1}{file} {\tl_show:n {Success~##1}} {\tl_show:n {Fail~##1}} } {\tl_show:n {"##1"~doesn't~exist!}} } } \ior_close:N \g_tmpa_ior } } \ExplSyntaxOff \begin{document} \getstuff{files} \end{document}
\pdffilesizehere: it's subtle but is why if you try the example with pdfTeX everything says it is found!