corsiKa
corsiKa

Reputation: 82559

Ant copy task thinks absolute paths are in local directory

I have a snippet of a file copy that looks like this:

<echo message="Root = ${original.src.root}" />
<copy todir="${source.root}">
    <fileset dir="${original.src.root}"/>
</copy>

Now, let's say that ${source.root} is "d:/build/src" and ${original.src.root} is "d:/projects/myproj/src".

I get a message that says `D:\projects\myproj\scripts\build.xml:224: D:\projects\myproj\scripts\"D:\projects\myproj\src" does not exist.

Well of course I don't have a src directory in my scripts directory. When I do the echo message, it says my original.src.root variable is properly set. So why would it be trying to reference the basedir for an absolute path?

Upvotes: 0

Views: 1517

Answers (1)

corsiKa
corsiKa

Reputation: 82559

Absolute paths on Windows are only treated as absolute paths if they start with a letter followed by a colon, for example D:/mydir. If it is enclosed in quotes, like "D:/mydir", it will not see an absolute path.

Upvotes: 5

Related Questions