[Kaffe] another bug in java.io.File
Moses DeJong
dejong at cs.umn.edu
Thu Jan 28 20:00:39 PST 1999
Hi all.
I ran into another problem with the java.io.File class. It seems like
the File.getCanonicalPath() method is broken. It should remove a ".."
in a directory path but it seem to do nothing. Does anyone know how
I could fix this problem? I have included a short example to show
how it differs from the JDK. It seems like the getCanonicalPath() is
going to need a native implementation so that it correctly deals with
symlinks n stuff.
import java.io.*;
public class CDTest {
public static void main(String[] argv) {
File pwd = new File("..");
try {
pwd = new File(pwd.getCanonicalPath());
} catch (IOException e) {
System.out.println("getCanonicalPath() raised " + e.getMessage());
}
System.out.println("PWD is \"" + pwd + "\"");
}
}
/*
JDK output
PWD is "/tmp/mo/tcljava1.2.1"
*/
/*
Kaffe output
PWD is "/tmp/mo/tcljava1.2.1/bugs/.."
*/
later
mo dejong
dejong at cs.umn.edu
More information about the kaffe
mailing list