Stefan,

> > I've noticed that the normalize(File) method in FileUtils requires
> > that the File to normalize is absolute.  I was wondering what the
> > reason is for this reason.
> 
> I'm not entirely sure (we extracted the code from Project way back
> IIRC).  On problem I can imagine is that of relative paths that go up
> beyond "", something like normalize("../../foo").
> 

You currently have the same problem with a path like "/../foo", even though
a Unix system would return "/foo" in a case like this.

> > Even a path like "../foo" could be normalized using the system
> > property "user.dir",
> 
> No, most invocations of normalize happen from resolveFile, so you
> already know which absolute directory to resolve against.  ${user.dir}
> is almost always wrong for Ant's own usage.
> 

If you know what directory to resolve against, even the better.  Then you
can from resolveFile(file, filename) do something like normalize(new
File(file, filename)).  As it is now these two methods have quite a bit of
common code.

But this is really a minor issue, so maybe it's not worth bothering.

--
knut

Reply via email to