[kaffe] CVS kaffe (robilad): Resynced with GNU Classpath: cleanup in File

Kaffe CVS cvs-commits at kaffe.org
Fri Dec 3 05:42:08 PST 2004


PatchSet 5518 
Date: 2004/12/03 13:37:43
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
Resynced with GNU Classpath: cleanup in File

2004-12-03  Dalibor Topic  <robilad at kaffe.org>

        * libraries/javalib/java/io/File.java,
        libraries/javalib/java/io/VMFile.java:
        Resynced with GNU Classpath.

        2004-11-26  Jeroen Frijters  <jeroen at frijters.net>

        * java/io/File.java
        (canWrite): Moved directory write test to VMFile.
        * vm/reference/java/io/VMFile.java
        (canWriteDirectory): New method.

Members: 
	ChangeLog:1.3064->1.3065 
	libraries/javalib/java/io/File.java:1.57->1.58 
	libraries/javalib/java/io/VMFile.java:1.4->1.5 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.3064 kaffe/ChangeLog:1.3065
--- kaffe/ChangeLog:1.3064	Fri Dec  3 11:38:32 2004
+++ kaffe/ChangeLog	Fri Dec  3 13:37:43 2004
@@ -1,5 +1,18 @@
 2004-12-03  Dalibor Topic  <robilad at kaffe.org>
 
+	* libraries/javalib/java/io/File.java,
+	libraries/javalib/java/io/VMFile.java:
+        Resynced with GNU Classpath.
+
+	2004-11-26  Jeroen Frijters  <jeroen at frijters.net>
+
+	* java/io/File.java
+	(canWrite): Moved directory write test to VMFile.
+	* vm/reference/java/io/VMFile.java
+	(canWriteDirectory): New method.
+
+2004-12-03  Dalibor Topic  <robilad at kaffe.org>
+
 	* libraries/javalib/java/awt/image/MultiPixelPackedSampleModel.java:
         Resynced with GNU Classpath.
 
Index: kaffe/libraries/javalib/java/io/File.java
diff -u kaffe/libraries/javalib/java/io/File.java:1.57 kaffe/libraries/javalib/java/io/File.java:1.58
--- kaffe/libraries/javalib/java/io/File.java:1.57	Thu Nov 11 03:11:28 2004
+++ kaffe/libraries/javalib/java/io/File.java	Fri Dec  3 13:37:46 2004
@@ -144,25 +144,10 @@
     if (! VMFile.exists(path))
       return false;
 
-    if (!VMFile.isDirectory(path))
-      return VMFile.canWrite(path);
+    if (VMFile.isDirectory(path))
+      return VMFile.canWriteDirectory(this);
     else
-      try
-        {
-          /* If the separator is '\' a DOS-style-filesystem is assumed
-             and a short name is used, otherwise use a long name.
-             WARNING: some implementation of DOS-style-filesystems also
-             accept '/' as separator. In that case the following code
-             will fail.
-          */
-          String filename = (separatorChar!='\\')?"test-dir-write":"tst";
-  	  File test = createTempFile(filename, null, this);
-  	  return (test != null && test.delete());
-        }
-      catch (IOException ioe)
-        {
-  	  return false;
-        }
+      return VMFile.canWrite(path);
   }
 
   /**
Index: kaffe/libraries/javalib/java/io/VMFile.java
diff -u kaffe/libraries/javalib/java/io/VMFile.java:1.4 kaffe/libraries/javalib/java/io/VMFile.java:1.5
--- kaffe/libraries/javalib/java/io/VMFile.java:1.4	Thu Nov 11 01:56:27 2004
+++ kaffe/libraries/javalib/java/io/VMFile.java	Fri Dec  3 13:37:46 2004
@@ -126,6 +126,23 @@
   static synchronized native boolean canWrite(String path);
 
   /**
+   * This methods checks if a directory can be written to.
+   */
+  static boolean canWriteDirectory(File dir)
+  {
+    try
+      {
+        String filename = IS_DOS_8_3 ? "tst" : "test-dir-write";
+        File test = File.createTempFile(filename, null, dir);
+        return (test != null && test.delete());
+      }
+    catch (IOException ioe)
+      {
+        return false;
+      }
+  }
+
+  /**
    * This native method checks file permissions for reading
    */
   static synchronized native boolean canRead(String path);




More information about the kaffe mailing list