I have an Ant task in Eclipse to get the version from a file:
<loadfile property="version" srcfile="version.txt"> <filterchain> <linecontainsregexp> <regexp pattern="^#define version .(\d{1,10})\.(\d{1,10})\.(\d{1,10})\.(\d{1,10})."/> </linecontainsregexp> <replaceregex pattern="^#define version .(\d{1,10})\.(\d{1,10})\.(\d{1,10})\.(\d{1,10})..*$" replace="\1.\2.\3.\4" /> </filterchain> </loadfile> <echo message="Version ${version}"/>
The version is displayed without a new line. Further in the code, I want to use a property with a move task:
<move file="${dir}\file.exe" tofile="${outputdir}\output-${version}-xxx.exe" overwrite="true" force="true" />
But this fails with the message
BUILD FAILED build.xml:26: Failed to copy path\file.exe to path\output_directory\output-1.0.0.0 -xxx.exe due to output-1.0.0.0 -xxx.exe (Nรกzev souboru ฤi adresรกลe nebo jmenovka svazku je nesprรกvnรก)
(the last line means that the file name is invalid, it is obvious that it contains a new line in the middle).
Where am I mistaken? Is this a property? Even adding a line
<replaceregex pattern=" " replace="" flags="s"/>
or other attempts to remove new lines from the property have not changed anything.
source share