convert forward slashes to back slashes in Windows paths

This commit is contained in:
Joel Dice 2010-01-11 08:31:01 -07:00
parent b1a1391093
commit 2c4e229e6e

View File

@ -24,7 +24,7 @@ public class File {
public File(String path) {
if (path == null) throw new NullPointerException();
this.path = path;
this.path = normalize(path);
}
public File(String parent, String child) {
@ -35,6 +35,14 @@ public class File {
this(parent.getPath() + FileSeparator + child);
}
private static String normalize(String path) {
if ("\\".equals(FileSeparator)) {
return path.replace('/', '\\');
} else {
return path;
}
}
public static native boolean rename(String old, String new_);
public boolean renameTo(File newName) {