Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ant pathconvert is not accepting newlines

Tags:

ant

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

like image 722
BreakPhreak Avatar asked Feb 08 '12 12:02

BreakPhreak


1 Answers

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}" />
like image 168
skaffman Avatar answered Nov 01 '22 01:11

skaffman