DOS drive names

Marcus G. Daniels mgd at swarm.org
Mon Feb 7 17:46:35 PST 2000



This isn't suitable as a patch, but here are two places where
DOS-style pathnames (C:\path\file) aren't handled, and spooky things
happen as a result...

diff -c -r1.15 File.c
*** libraries/clib/io/File.c	2000/01/05 00:16:20	1.15
--- libraries/clib/io/File.c	2000/02/08 01:36:12
***************
*** 311,320 ****
  jbool
  java_io_File_isAbsolute(struct Hjava_io_File* this)
  {
! 	char str[2];
  
  	stringJava2CBuf(unhand(this)->path, str, sizeof(str));
! 	return (str[0] == file_separator[0]);
  }
  
  jboolean
--- 311,324 ----
  jbool
  java_io_File_isAbsolute(struct Hjava_io_File* this)
  {
! 	char str[3];
  
  	stringJava2CBuf(unhand(this)->path, str, sizeof(str));
! 	return 
! #ifdef __CYGWIN__
! 	  (str[1] == ':') ||
! #endif
! 	  (str[0] == file_separator[0]);
  }
  
  jboolean
diff -c -r1.24 File.java
*** libraries/javalib/java/io/File.java	2000/01/13 21:04:39	1.24
--- libraries/javalib/java/io/File.java	2000/02/08 01:40:05
***************
*** 184,191 ****
          // Build a string of the remaining elements.
          StringBuffer buf = new StringBuffer();
          for (int i = 0; i < j; i++) {
  		buf.append(separatorChar);
!                 buf.append(array[i]);
          }
          return (buf.toString());
  }
--- 184,194 ----
          // Build a string of the remaining elements.
          StringBuffer buf = new StringBuffer();
          for (int i = 0; i < j; i++) {
+ 	    if (!(i == 0
+ 		  && array[i].length () == 2
+ 		  && array[i].lastIndexOf (':') == 1))
  		buf.append(separatorChar);
! 	    buf.append(array[i]);
          }
          return (buf.toString());
  }


More information about the kaffe mailing list