On 4/27/13 3:34 PM, Alan Bateman wrote:
On 27/04/2013 04:14, Weijun Wang wrote:
I thought that in this case parent is just ignored and it's still the
child itself. Turns out this is not true, and

   new File("/tmp", "/etc/passwd") is /tmp/etc/passwd

Is this really useful in any way?
I agree this isn't always obvious but this is how this method was
originally specified (JDK1.1, maybe JDK1.0). I've no doubt that
attempting to change it now would cause breakage, particularly Windows
where a file path such as "/etc/passwd" is a relative path. Can you use
java.nio.file.Path for what you are doing? It has resolve methods that
do the right thing.

Great. I should have thought of it. Path/Files/Paths are precious.

Thanks
Max


-Alan.

Reply via email to