privatestaticvoid checkCaseLookup() throws IOException { /* Use long names here to avoid 8.3 format, which Samba servers often
force to lowercase */
File r = new File (workSubDir, "XyZzY0123");
File d = new File(r, "FOO_bar_BAZ");
File f = new File(d, "GLORPified"); if (!f.exists()) { if (!d.exists()) { if (!d.mkdirs()) { thrownew RuntimeException("Can't create directory " + d);
}
}
OutputStream o = new FileOutputStream(f);
o.close();
}
File f2 = new File(d.getParent(), "mumble"); /* For later ud tests */ if (!f2.exists()) {
OutputStream o = new FileOutputStream(f2);
o.close();
}
/* Computing the canonical path of a Win32 file should expose the true
case of filenames, rather than just using the input case */
File y = new File(userDir, f.getPath());
String ans = y.getPath();
check(ans, workSubDir + File.separator + "XyZzY0123\\FOO_bar_BAZ\\GLORPified");
check(ans, workSubDir + File.separator + "xyzzy0123\\foo_bar_baz\\glorpified");
check(ans, workSubDir + File.separator + "XYZZY0123\\FOO_BAR_BAZ\\GLORPIFIED");
}
privatestaticvoid checkRelativePaths(int depth) throws Exception {
checkCaseLookup();
checkWildCards(); // Make sure that an empty relative path is tested
checkNames(1, true, userDir + File.separator, "");
checkNames(depth, true, baseDir + File.separator,
relative + File.separator);
}
/* Pathnames with drive specifiers */
privatestaticchar findInactiveDrive() { for (char d = 'Z'; d >= 'E'; d--) {
File df = new File(d + ":\\"); if (!df.exists()) { return d;
}
} thrownew RuntimeException("Can't find an inactive drive");
}
privatestaticchar findActiveDrive() { for (char d = 'C'; d <= 'Z'; d--) {
File df = new File(d + ":\\"); if (df.exists()) return d;
} thrownew RuntimeException("Can't find an active drive");
}
privatestaticvoid checkDrive(int depth, String drive, boolean exists) throws Exception
{
File df = new File(drive);
String ans = exists ? df.getAbsolutePath() : drive; if (!ans.endsWith("\\"))
ans = ans + "\\";
checkNames(depth, false, ans, drive);
}
s = "\\\\" + EXISTENT_UNC_HOST + "\\" + EXISTENT_UNC_SHARE; if (!(new File(s)).exists()) {
System.err.println("WARNING: " + s + " does not exist, unable to test UNC pathnames"); return;
}
checkSlashes(depth, false, s, s);
}
publicstaticvoid main(String[] args) throws Exception { if (File.separatorChar != '\\') { /* This test is only valid on win32 systems */ return;
} if (args.length > 0) debug = true;
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.