diff options
Diffstat (limited to 'libjava/java/io/File.java')
-rw-r--r-- | libjava/java/io/File.java | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/libjava/java/io/File.java b/libjava/java/io/File.java index 01d8d53fee9..fc3477c040b 100644 --- a/libjava/java/io/File.java +++ b/libjava/java/io/File.java @@ -388,6 +388,24 @@ public class File implements Serializable FileDeleter.add (this); } + private void writeObject (ObjectOutputStream oos) throws IOException + { + oos.defaultWriteObject (); + oos.writeChar (separatorChar); + } + + private void readObject (ObjectInputStream ois) + throws ClassNotFoundException, IOException + { + ois.defaultReadObject (); + + // If the file was from an OS with a different dir separator, + // fixup the path to use the separator on this OS. + char oldSeparatorChar = ois.readChar (); + if (oldSeparatorChar != separatorChar) + path = path.replace (oldSeparatorChar, separatorChar); + } + // QUERY arguments to access function. private final static int READ = 0; private final static int WRITE = 1; @@ -404,4 +422,6 @@ public class File implements Serializable private final native long attr (String p, int query); private final native boolean access (String p, int query); private final native boolean stat (String p, int query); + + private static final long serialVersionUID = 301077366599181567L; } |