/[classpath]/classpath/java/io/File.java
ViewVC logotype

Diff of /classpath/java/io/File.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.51 by mkoch, Wed Oct 20 08:08:52 2004 UTC revision 1.52 by jfrijters, Mon Nov 8 09:21:26 2004 UTC
# Line 228  public class File implements Serializabl Line 228  public class File implements Serializabl
228            
229      File other = (File) obj;      File other = (File) obj;
230    
231      if (VMFile.caseSensitive)      if (VMFile.IS_CASE_SENSITIVE)
232        return path.equals(other.path);        return path.equals(other.path);
233      else      else
234        return path.equalsIgnoreCase(other.path);        return path.equalsIgnoreCase(other.path);
# Line 631  public class File implements Serializabl Line 631  public class File implements Serializabl
631     */     */
632    public int hashCode()    public int hashCode()
633    {    {
634      if (VMFile.caseSensitive)      if (VMFile.IS_CASE_SENSITIVE)
635        return path.hashCode() ^ 1234321;        return path.hashCode() ^ 1234321;
636      else      else
637        return path.toLowerCase().hashCode() ^ 1234321;        return path.toLowerCase().hashCode() ^ 1234321;
# Line 1101  public class File implements Serializabl Line 1101  public class File implements Serializabl
1101      if (suffix == null)      if (suffix == null)
1102        suffix = ".tmp";        suffix = ".tmp";
1103    
1104      /* Now identify a file name and make sure it doesn't exist.      // 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.  
     */  
1105      File file;      File file;
1106      if (separatorChar!='\\')      if (!VMFile.IS_DOS_8_3)
1107        {              {      
         // probably a non-DOS-filesystem, use long names  
1108          do          do
1109            {            {
1110              String filename = prefix + System.currentTimeMillis() + suffix;              String filename = prefix + System.currentTimeMillis() + suffix;
# Line 1121  public class File implements Serializabl Line 1114  public class File implements Serializabl
1114        }        }
1115      else      else
1116        {        {
         // probably a DOS-filesystem, use short names (8+3)  
   
1117          // make sure prefix is not longer than 7 characters          // make sure prefix is not longer than 7 characters
1118          if (prefix.length() >= 8)          if (prefix.length() >= 8)
1119            throw new IllegalArgumentException("Prefix too long: " + prefix + "(valid length 3..7)");            throw new IllegalArgumentException("Prefix too long: " + prefix + "(valid length 3..7)");
# Line 1241  public class File implements Serializabl Line 1232  public class File implements Serializabl
1232     */     */
1233    public int compareTo(File other)    public int compareTo(File other)
1234    {    {
1235      if (VMFile.caseSensitive)      if (VMFile.IS_CASE_SENSITIVE)
1236        return path.compareTo (other.path);        return path.compareTo (other.path);
1237      else      else
1238        return path.compareToIgnoreCase (other.path);        return path.compareToIgnoreCase (other.path);

Legend:
Removed from v.1.51  
changed lines
  Added in v.1.52

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26