ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Benson <gudnabr...@yahoo.com>
Subject Re: Detecting directory versus symlink
Date Sat, 21 Mar 2009 19:15:05 GMT

It is intended that <symlink action="delete" ...> should silently ignore real files.
 I would recommend testing this in existing releases before you rely on it, but if you're
a bleeding-edge type the code has been reworked quite a bit in Ant's trunk so should cure
any problems you might encounter with the released code (not saying you will, but check!).
 If you then try to delete the symlink and the directory is still available, it must be a
real one.  Failing that, you could drop down to scripting or custom task level where FileUtils
has a method to check whether a file is a link (SymbolicLinkUtils in trunk)--the basic check
is whether a file's absolute path and its canonical path are equal.  <symlink>'s documentation
includes a caveat about using this check on non-*nix systems, but hopefully that is a moot
point for you.

Hope this helps,
Matt

--- On Fri, 3/20/09, Michael Delaney <mdelaney@upromise.com> wrote:

> From: Michael Delaney <mdelaney@upromise.com>
> Subject: Detecting directory versus symlink
> To: "Ant Users List" <user@ant.apache.org>
> Date: Friday, March 20, 2009, 2:36 PM
> In ant 1.7.0, is there a way to test
> if a resource is a directory or if it's a symlink?
> 
> I have a directory /app/product/foo which may, or may not
> be a symlink. If it's a symlink, I just want to remove the
> symlink but if it's a directory, I have another set of
> instructions I need to follow. Anyone have any advice on
> what the best way to determine if a resource is a directory
> or a symlink?
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
> 


      

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


Mime
View raw message