diff options
author | Bryce McKinlay <bryce@albatross.co.nz> | 2001-04-01 11:16:40 +0000 |
---|---|---|
committer | Bryce McKinlay <bryce@gcc.gnu.org> | 2001-04-01 12:16:40 +0100 |
commit | f40475404235a392b16bb7db048fc18c56af3604 (patch) | |
tree | 64ffcb42dcabba681035f83df8bad41e16ad89de /libjava/java/lang | |
parent | e74061a981cd8d62e366c6bc96454250e7da0450 (diff) | |
download | gcc-f40475404235a392b16bb7db048fc18c56af3604.zip gcc-f40475404235a392b16bb7db048fc18c56af3604.tar.gz gcc-f40475404235a392b16bb7db048fc18c56af3604.tar.bz2 |
1.3-Compliant Implementation of java.io.File.
* java/lang/natSystem.cc (init_properties): Get "file.separator",
"path.separator", and "java.io.tmpdir" from the File class, instead
of setting them explicitly.
* java/io/File.java: Do not canonicalize paths for security manager
checks. Call init_native() from static initializer. Do not pass path
argument to native methods. New native method declarations. Some
security manager checks moved to checkWrite().
(equals): Check file system case sensitivity and act appropriatly.
(hashCode): Likewise.
(isHidden): New method implemented.
(performList): Changed prototype. Now takes a class argument specifying
the class of the returned array: Strings or File objects. Also added
FileFilter argument.
(listFiles): New variants with "File" return type implemented.
(createTempFile): Use createNewFile(). Use maxPathLen.
(setReadOnly): New method implemented.
(listRoots): Likewise.
(compareTo): Likewise.
(setLastModified): Likewise.
(checkWrite): New method.
(setPath): Removed.
* java/io/natFile.cc: Various functions no longer take canonical path
argument.
(stat): Handle ISHIDDEN query.
(isAbsolute): Remove WIN32 cruft.
(performList): New arguments. Handle returning either File[] or
String[] arrays. Check with FileFilter or FilenameFilter arguments as
appropriate. Use an ArrayList, not a Vector, for the temporary list.
(performSetReadOnly): New method implemented.
(performListRoots): Likewise.
(performSetLastModified): Likewise.
(performCreate): Likewise.
(init_native): New initialization function.
* java/io/natFileWin32.cc: Various functions no longer take canonical
path argument.
(stat): Add FIXME about ISHIDDEN query.
(performList): New arguments. Handle returning either File[] or String[]
arrays. Check with FileFilter or FilenameFilter arguments as
appropriate. Use an ArrayList, not a Vector, for the temporary list.
(performSetReadOnly): New. Stubbed.
(performListRoots): Likewise.
(performSetLastModified): Likewise.
(performCreate): Likewise.
(init_native) New initialization function.
* configure.in: Check for utime() and chmod().
* configure: Rebuilt.
* include/config.h.in: Rebuilt.
Resolves PR libgcj/1759.
From-SVN: r40985
Diffstat (limited to 'libjava/java/lang')
-rw-r--r-- | libjava/java/lang/natSystem.cc | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/libjava/java/lang/natSystem.cc b/libjava/java/lang/natSystem.cc index abf62ca..ee1d998 100644 --- a/libjava/java/lang/natSystem.cc +++ b/libjava/java/lang/natSystem.cc @@ -55,6 +55,7 @@ details. */ #include <java/lang/StringBuffer.h> #include <java/util/Properties.h> #include <java/util/TimeZone.h> +#include <java/io/File.h> #include <java/io/PrintStream.h> #include <java/io/InputStream.h> @@ -323,20 +324,19 @@ java::lang::System::init_properties (void) SET ("file.encoding", default_file_encoding); + JvInitClass (&java::io::File::class$); + newprops->put (JvNewStringLatin1 ("file.separator"), + java::io::File::separator); + newprops->put (JvNewStringLatin1 ("path.separator"), + java::io::File::pathSeparator); + newprops->put (JvNewStringLatin1 ("java.io.tmpdir"), + java::io::File::tmpdir); + #ifdef WIN32 - SET ("file.separator", "\\"); - SET ("path.separator", ";"); SET ("line.separator", "\r\n"); - SET ("java.io.tmpdir", "C:\\temp"); #else // Unix. - SET ("file.separator", "/"); - SET ("path.separator", ":"); SET ("line.separator", "\n"); - char *tmpdir = ::getenv("TMPDIR"); - if (! tmpdir) - tmpdir = "/tmp"; - SET ("java.io.tmpdir", tmpdir); #endif #ifdef HAVE_UNAME |