summaryrefslogtreecommitdiff
path: root/vm
diff options
context:
space:
mode:
authorMario Torre <neugens@limasoftware.net>2008-04-09 20:23:10 +0000
committerMario Torre <neugens@limasoftware.net>2008-04-09 20:23:10 +0000
commit26c7eeb38377d6ddbf58a8360e52d29179ee0c97 (patch)
tree6ede434d301dd9d2459545f9974012beb174e9f4 /vm
parent859285709b02bf70062853865fb322cfe932e25b (diff)
downloadclasspath-26c7eeb38377d6ddbf58a8360e52d29179ee0c97.tar.gz
2008-04-09 Mario Torre <neugens@aicas.com>
* java/io/File.java (canWrite): use canWriteDirectory(String). * vm/reference/java/io/VMFile.java (canWriteDirectory): new native method. * native/jni/java-io/java_io_VMFile.c: correct indentation, sync function names with header file definition. (Java_java_io_VMFile_canRead): use cpio_checkAccess to get access permission. Removed unused variable. (Java_java_io_VMFile_canWrite): likewise. (Java_java_io_VMFile_canWriteDirectory): new function.
Diffstat (limited to 'vm')
-rw-r--r--vm/reference/java/io/VMFile.java26
1 files changed, 11 insertions, 15 deletions
diff --git a/vm/reference/java/io/VMFile.java b/vm/reference/java/io/VMFile.java
index 2a2751765..9f584af23 100644
--- a/vm/reference/java/io/VMFile.java
+++ b/vm/reference/java/io/VMFile.java
@@ -58,10 +58,10 @@ final class VMFile
{
if (Configuration.INIT_LOAD_LIBRARY)
{
- System.loadLibrary("javaio");
+ System.loadLibrary("javaio");
}
}
-
+
/*
* This native method does the actual work of getting the last file
* modification time. It also does the existence check to avoid the
@@ -167,19 +167,7 @@ final class VMFile
/**
* This methods checks if a directory can be written to.
*/
- static boolean canWriteDirectory(File dir)
- {
- try
- {
- String filename = IS_DOS_8_3 ? "tst" : "test-dir-write";
- File test = File.createTempFile(filename, null, dir);
- return (test != null && test.delete());
- }
- catch (IOException ioe)
- {
- return false;
- }
- }
+ static native boolean canWriteDirectory(String path);
/**
* This native method checks file permissions for reading
@@ -199,6 +187,14 @@ final class VMFile
static native boolean isDirectory(String dirpath);
/**
+ * This methods checks if a directory can be written to.
+ */
+ static boolean canWriteDirectory(File path)
+ {
+ return canWriteDirectory(path.getAbsolutePath());
+ }
+
+ /**
* This method returns an array of filesystem roots. Some operating systems
* have volume oriented filesystem. This method provides a mechanism for
* determining which volumes exist. GNU systems use a single hierarchical