I don't know the answer to that question, but I do know that it's actually more work to get the canonical path than to get the absolute path, because File.getCanonicalPath() throws an exception which must be caught, and absolute path doesn't. This makes me think that the original author must have had some good reason for deciding on getCanonicalPath rather than getAbsolutePath. The code falls back to getAbsolutePath in the case where getCanonicalPath throws an exception. There are other calls which my patch does not address, such as when getting the path of the build file (in some cases it would not even be possible to invoke Project.resolveFile() because they are made before the project object is created. In cases where it looked like it made sense for me to do so I changed the code from calling getCanonicalPath directly to calling it via the Project.resolveFile() call, which then means for those cases that I changed my new logic is always invoked.
I don't mind whether the behavior is the default or not, and I am not sure that my solution is the best one, but this patch is in place on my system and resolves the problem for me. It may require reworking by someone who understands better the workings of the entire system before it can be put into place by a commiter. Thanks, Julian. ----- Original Message ----- From: "Jesse Glick" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, February 14, 2001 9:49 PM Subject: Re: [patch] absolute/relative paths > "Julian M. Savage" wrote: > > [snip] > > This patch solves my problem; if you set a property > > "ant.project.useabsolute" then Project.resolveFile() will use > > getAbsolutePath() rather than getCanonical(). > > Should this behavior even be optional and not the default? Is there any > reason why you would want Ant to canonicalize symlinks to begin with? > > -Jesse > > -- > Jesse Glick <mailto:[EMAIL PROTECTED]> > NetBeans, Open APIs <http://www.netbeans.org/> > tel (+4202) 3300-9161 Sun Micro x49161 Praha CR > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >
