Commit fcfdb145 by Alfred M. Szmidt Committed by Matthias Klose

natFilePosix.cc (init_native): Define to 0.

2007-08-04  Alfred M. Szmidt  <ams@gnu.org>

        * java/io/natFilePosix.cc (init_native) [!MAXPATHLEN]: Define to 0.
        * java/io/File.java (createTempFile): Don't truncate if the system
        doesn't have a limit on the length of a file name.
        * classpath/lib/java/io/File.class: Regenerate.

From-SVN: r127216
parent cbef3aa2
2007-08-04 Alfred M. Szmidt <ams@gnu.org>
* java/io/natFilePosix.cc (init_native) [!MAXPATHLEN]: Define to 0.
* java/io/File.java (createTempFile): Don't truncate if the system
doesn't have a limit on the length of a file name.
* classpath/lib/java/io/File.class: Regenerate.
2007-08-04 Matthias Klose <doko@ubuntu.com> 2007-08-04 Matthias Klose <doko@ubuntu.com>
Import GNU Classpath (libgcj-import-20070727). Import GNU Classpath (libgcj-import-20070727).
......
...@@ -117,6 +117,7 @@ public class File implements Serializable, Comparable<File> ...@@ -117,6 +117,7 @@ public class File implements Serializable, Comparable<File>
public static final char pathSeparatorChar = pathSeparator.charAt(0); public static final char pathSeparatorChar = pathSeparator.charAt(0);
static final String tmpdir = System.getProperty("java.io.tmpdir"); static final String tmpdir = System.getProperty("java.io.tmpdir");
/* If 0, then the system doesn't have a file name length limit. */
static int maxPathLen; static int maxPathLen;
static boolean caseSensitive; static boolean caseSensitive;
...@@ -1130,7 +1131,9 @@ public class File implements Serializable, Comparable<File> ...@@ -1130,7 +1131,9 @@ public class File implements Serializable, Comparable<File>
// Truncation rules. // Truncation rules.
// `6' is the number of characters we generate. // `6' is the number of characters we generate.
if (prefix.length() + 6 + suffix.length() > maxPathLen) // If maxPathLen equals zero, then the system doesn't have a limit
// on the file name, so there is nothing to truncate.
if (maxPathLen > 0 && prefix.length() + 6 + suffix.length() > maxPathLen)
{ {
int suf_len = 0; int suf_len = 0;
if (suffix.charAt(0) == '.') if (suffix.charAt(0) == '.')
......
...@@ -504,6 +504,12 @@ java::io::File::performDelete (void) ...@@ -504,6 +504,12 @@ java::io::File::performDelete (void)
void void
java::io::File::init_native () java::io::File::init_native ()
{ {
#ifdef MAXPATHLEN
maxPathLen = MAXPATHLEN; maxPathLen = MAXPATHLEN;
#else
/* Some systems do not have a limit on the length of a file name,
the GNU system is one such example. */
maxPathLen = 0;
#endif
caseSensitive = true; caseSensitive = true;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment