-----Original Message-----
From: Matt Benson <[email protected]>
Sent: Saturday, March 21, 2009 2:15 PM
To: Ant Users List <[email protected]>
Subject: Re: Detecting directory versus symlink


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 <[email protected]> wrote:

> From: Michael Delaney <[email protected]>
> Subject: Detecting directory versus symlink
> To: "Ant Users List" <[email protected]>
> 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: [email protected]
> For additional commands, e-mail: [email protected]
> 


[The entire original message is not included]

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to