Tilde and Ant

View: New views
3 Messages — Rating Filter:   Alert me  

Tilde and Ant

by testn :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

My ant script uses tilde "~" in the path. It seems to work fine with my colleagues but it failed to work in my unix machine. When I copy files to ~/deploy, instead of creating a directory called deploy in my home directory, it actually creates "~/deploy" in my current directory instead. I know I should use "${user.home}", but does anyone have any idea why it happened?

Re: Tilde and Ant

by Steve Loughran :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

testn wrote:
> My ant script uses tilde "~" in the path. It seems to work fine with my
> colleagues but it failed to work in my unix machine. When I copy files to
> ~/deploy, instead of creating a directory called deploy in my home
> directory, it actually creates "~/deploy" in my current directory instead. I
> know I should use "${user.home}", but does anyone have any idea why it
> happened?

yes. ~ is interpreted by the shell, and Ant has no shell. You cant use
~/something in Java code or even C/C++ apps.

--
Steve Loughran                  http://www.1060.org/blogxter/publish/5
Author: Ant in Action           http://antbook.org/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@...
For additional commands, e-mail: user-help@...


Re: Tilde and Ant

by testn :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks for the reply. How do you explain why it does work on other machines as well as other users?

Steve Loughran wrote:
testn wrote:
> My ant script uses tilde "~" in the path. It seems to work fine with my
> colleagues but it failed to work in my unix machine. When I copy files to
> ~/deploy, instead of creating a directory called deploy in my home
> directory, it actually creates "~/deploy" in my current directory instead. I
> know I should use "${user.home}", but does anyone have any idea why it
> happened?

yes. ~ is interpreted by the shell, and Ant has no shell. You cant use
~/something in Java code or even C/C++ apps.

--
Steve Loughran                  http://www.1060.org/blogxter/publish/5
Author: Ant in Action           http://antbook.org/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org