[kaffe] CVS kaffe (robilad): Resynced with GNU Classpath: Use VMFile.IS_DOS_8_3 to test for DOS filesystem

Kaffe CVS cvs-commits at kaffe.org
Wed Nov 10 18:00:40 PST 2004


PatchSet 5440 
Date: 2004/11/11 01:56:24
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
Resynced with GNU Classpath: Use VMFile.IS_DOS_8_3 to test for DOS filesystem

2004-11-11  Dalibor Topic  <robilad at kaffe.org>

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

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

        * java/io/File.java:
        (createTempFile): Use VMFile.IS_DOS_8_3 instead of separatorChar
        to determine file system naming restrictions.
        * vm/reference/java/io/VMFile.java
        (caseSensitive): Renamed to IS_CASE_SENSITIVE.
        (IS_DOS_8_3): New field.

Members: 
	ChangeLog:1.2987->1.2988 
	libraries/javalib/java/io/File.java:1.55->1.56 
	libraries/javalib/java/io/VMFile.java:1.3->1.4 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.2987 kaffe/ChangeLog:1.2988
--- kaffe/ChangeLog:1.2987	Thu Nov 11 01:33:49 2004
+++ kaffe/ChangeLog	Thu Nov 11 01:56:24 2004
@@ -1,5 +1,20 @@
 2004-11-11  Dalibor Topic  <robilad at kaffe.org>
 
+	* libraries/javalib/java/io/File.java,
+	libraries/javalib/java/io/VMFile.java:
+        Resynced with GNU Classpath.
+
+	2004-11-08  Jeroen Frijters  <jeroen at frijters.net>
+
+        * java/io/File.java:
+        (createTempFile): Use VMFile.IS_DOS_8_3 instead of separatorChar
+        to determine file system naming restrictions.
+        * vm/reference/java/io/VMFile.java
+        (caseSensitive): Renamed to IS_CASE_SENSITIVE.
+        (IS_DOS_8_3): New field.
+
+2004-11-11  Dalibor Topic  <robilad at kaffe.org>
+
 	* libraries/javalib/java/awt/image/LookupOp.java:
         Resynced with GNU Classpath.
 
Index: kaffe/libraries/javalib/java/io/File.java
diff -u kaffe/libraries/javalib/java/io/File.java:1.55 kaffe/libraries/javalib/java/io/File.java:1.56
--- kaffe/libraries/javalib/java/io/File.java:1.55	Sat Oct 23 11:24:19 2004
+++ kaffe/libraries/javalib/java/io/File.java	Thu Nov 11 01:56:27 2004
@@ -155,7 +155,7 @@
              accept '/' as separator. In that case the following code
              will fail.
           */
-          String filename = (!ON_WINDOWS)?"test-dir-write":"tst";
+          String filename = (separatorChar!='\\')?"test-dir-write":"tst";
   	  File test = createTempFile(filename, null, this);
   	  return (test != null && test.delete());
         }
@@ -228,7 +228,7 @@
     
     File other = (File) obj;
 
-    if (VMFile.caseSensitive)
+    if (VMFile.IS_CASE_SENSITIVE)
       return path.equals(other.path);
     else
       return path.equalsIgnoreCase(other.path);
@@ -264,7 +264,7 @@
   {
     // On Windows, convert any '/' to '\'.  This appears to be the same logic
     // that Sun's Win32 Java performs.
-    if (ON_WINDOWS)
+    if (separatorChar == '\\')
       {
         p = p.replace ('/', '\\');
 	// We have to special case the "\c:" prefix.
@@ -288,7 +288,7 @@
         // example, is a valid and minimal path).
         if (plen > 1 && p.charAt (plen - 1) == separatorChar)
 	  {
-	    if (! (ON_WINDOWS && plen == 3 && p.charAt (1) == ':'))
+	    if (! (separatorChar == '\\' && plen == 3 && p.charAt (1) == ':'))
 	      return p.substring (0, plen - 1);
 	  }
 	else
@@ -317,7 +317,7 @@
     int end;
     if (plen > 1 && p.charAt (plen - 1) == separatorChar)
     {
-      if (ON_WINDOWS && plen == 3 && p.charAt (1) == ':')
+      if (separatorChar == '\\' && plen == 3 && p.charAt (1) == ':')
         end = plen;
       else
         end = plen - 1;
@@ -424,7 +424,7 @@
   {
     if (isAbsolute())
       return path;
-    else if (ON_WINDOWS 
+    else if (separatorChar == '\\' 
              && path.length() > 0 && path.charAt (0) == '\\')
       {
         // On Windows, even if the path starts with a '\\' it is not
@@ -432,7 +432,7 @@
         // the current working directory to it.
         return System.getProperty ("user.dir").substring (0, 2) + path;
       }
-    else if (ON_WINDOWS 
+    else if (separatorChar == '\\' 
              && path.length() > 1 && path.charAt (1) == ':'
              && ((path.charAt (0) >= 'a' && path.charAt (0) <= 'z')
                  || (path.charAt (0) >= 'A' && path.charAt (0) <= 'Z')))
@@ -493,7 +493,7 @@
   {
     // On Windows, getAbsolutePath might end up calling us, so we
     // have to special case that call to avoid infinite recursion.
-    if (ON_WINDOWS && path.length() == 2 &&
+    if (separatorChar == '\\' && path.length() == 2 &&
 	((path.charAt(0) >= 'a' && path.charAt(0) <= 'z') ||
 	 (path.charAt(0) >= 'A' && path.charAt(0) <= 'Z')) &&
 	path.charAt(1) == ':')
@@ -554,7 +554,7 @@
         prefix = "/";
         nameSeqIndex = 1;
       }
-    else if (ON_WINDOWS && path.length() > 1)
+    else if (separatorChar == '\\' && path.length() > 1)
       {
         if ((path.charAt (0) == '\\' && path.charAt (1) == '\\')
             || (((path.charAt (0) >= 'a' && path.charAt (0) <= 'z')
@@ -631,7 +631,7 @@
    */
   public int hashCode()
   {
-    if (VMFile.caseSensitive)
+    if (VMFile.IS_CASE_SENSITIVE)
       return path.hashCode() ^ 1234321;
     else
       return path.toLowerCase().hashCode() ^ 1234321;
@@ -648,7 +648,7 @@
    */
   public boolean isAbsolute()
   {
-    if (ON_WINDOWS)
+    if (separatorChar == '\\')
 	return path.startsWith(dupSeparator) || 
 	    (path.length() > 2 && 
 	     ((path.charAt(0) >= 'a' && path.charAt(0) <= 'z') ||
@@ -960,7 +960,7 @@
     if (isDirectory())
       abspath = abspath + separatorChar;
 
-    if (ON_WINDOWS)
+    if (separatorChar == '\\')
       abspath = separatorChar + abspath;
         
     try
@@ -991,7 +991,7 @@
   {
     // On Win32, Sun's JDK returns URLs of the form "file:/c:/foo/bar.txt",
     // while on UNIX, it returns URLs of the form "file:/foo/bar.txt". 
-    if (ON_WINDOWS)
+    if (separatorChar == '\\')
       return new URL ("file:/" + getAbsolutePath().replace ('\\', '/')
 		      + (isDirectory() ? "/" : ""));
     else
@@ -1101,17 +1101,10 @@
     if (suffix == null)
       suffix = ".tmp";
 
-    /* Now identify a file name and make sure it doesn't exist.
-       If the separator is '\' a DOS-style-filesystem is assumed and
-       a 8+3-filename is used, otherwise use a long name.
-       WARNGIN: some implementation of DOS-style-filesystems also
-       accept '/' as separator. In that case the following code
-       will fail.
-    */
+    // Now identify a file name and make sure it doesn't exist.
     File file;
-    if (!ON_WINDOWS)
+    if (!VMFile.IS_DOS_8_3)
       {      
-        // probably a non-DOS-filesystem, use long names
         do
           {
             String filename = prefix + System.currentTimeMillis() + suffix;
@@ -1121,8 +1114,6 @@
       }
     else
       {
-        // probably a DOS-filesystem, use short names (8+3)
-
         // make sure prefix is not longer than 7 characters
         if (prefix.length() >= 8)
           throw new IllegalArgumentException("Prefix too long: " + prefix + "(valid length 3..7)");
@@ -1241,7 +1232,7 @@
    */
   public int compareTo(File other)
   {
-    if (VMFile.caseSensitive)
+    if (VMFile.IS_CASE_SENSITIVE)
       return path.compareTo (other.path);
     else
       return path.compareToIgnoreCase (other.path);
@@ -1374,11 +1365,6 @@
     if (oldSeparatorChar != separatorChar)
       path = path.replace(oldSeparatorChar, separatorChar);
   }
-
-  /**
-   * Used to determine whether we are running under Windows.
-   */
-  private static final boolean ON_WINDOWS = separatorChar =='\\';
-
+  
 } // class File
 
Index: kaffe/libraries/javalib/java/io/VMFile.java
diff -u kaffe/libraries/javalib/java/io/VMFile.java:1.3 kaffe/libraries/javalib/java/io/VMFile.java:1.4
--- kaffe/libraries/javalib/java/io/VMFile.java:1.3	Sun Sep 12 09:14:55 2004
+++ kaffe/libraries/javalib/java/io/VMFile.java	Thu Nov 11 01:56:27 2004
@@ -47,19 +47,18 @@
  */
 final class VMFile
 {
-  static boolean caseSensitive;
-	
+  // FIXME: We support only case sensitive filesystems currently.
+  static final boolean IS_CASE_SENSITIVE = true;
+  static final boolean IS_DOS_8_3 = false;
+
   static
   {
     if (Configuration.INIT_LOAD_LIBRARY)
       {
 	System.loadLibrary("io");
       }
-
-    // FIXME: We support only caseSensitive filesystems currently.
-    caseSensitive = true;
   }
-  
+
   /*
    * This native method does the actual work of getting the last file
    * modification time.  It also does the existence check to avoid the




More information about the kaffe mailing list