privatestaticvoid ck(String path, String ans) throws Exception {
File f = new File(path);
String p = f.getAbsolutePath(); if ((ignoreCase && p.equalsIgnoreCase(ans)) || p.equals(ans))
System.err.println(path + " ==> " + p); else thrownew Exception(path + ": expected " + ans + ", got " + p);
}
privatestaticvoid testWin32() throws Exception {
String wd = System.getProperty("user.dir"); char d; if ((wd.length() > 2) && (wd.charAt(1) == ':')
&& (wd.charAt(2) == '\\'))
d = wd.charAt(0); else thrownew Exception("Current directory has no drive");
ck("/foo/bar", d + ":\\foo\\bar");
ck("\\foo\\bar", d + ":\\foo\\bar");
ck("c:\\foo\\bar", "c:\\foo\\bar");
ck("c:/foo/bar", "c:\\foo\\bar");
ck("\\\\foo\\bar", "\\\\foo\\bar");
/* Tricky directory-relative case */
d = Character.toLowerCase(d); char z = 0; if (d != 'c') z = 'c'; elseif (d != 'd') z = 'd'; if (z != 0) {
File f = new File(z + ":."); if (f.exists()) {
String zwd = f.getCanonicalPath();
ck(z + ":foo", zwd + "\\foo");
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.