diff --git a/classpath/java/io/File.java b/classpath/java/io/File.java index da87db791e..c3fa42932f 100644 --- a/classpath/java/io/File.java +++ b/classpath/java/io/File.java @@ -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) {