All I need is to create a file that contains a file names' list (separated by '\r\n' or '\n' depending on the OS) in a certain folder. For some reason, the code below doesn't work:
<fileset id="my_files" dir="./resource">
<include name="*.js" />
</fileset>
<pathconvert property="my_files_list" refid="my_files" pathsep="\r\n" />
<echo message="${my_files_list}" file="my_files_list.txt"/>
I am getting the files' list, separate by a string that includes four characters '\r\n' literally. First, I would like them to convert into the real (whitespace) newline, second, I would like them to have an OS-dependent delimiter.
Please advice
You should use the standard Ant line.separator
property, rather than hard-coding it to \r\n
. This is also more likely to work, rather than being mangled by Ant, as seems to be happening here.
So try this:
<pathconvert property="my_files_list" refid="my_files" pathsep="${line.separator}" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With