summaryrefslogtreecommitdiff
path: root/libjava/classpath/vm/reference/java/io/VMFile.java
diff options
context:
space:
mode:
Diffstat (limited to 'libjava/classpath/vm/reference/java/io/VMFile.java')
-rw-r--r--libjava/classpath/vm/reference/java/io/VMFile.java26
1 files changed, 11 insertions, 15 deletions
diff --git a/libjava/classpath/vm/reference/java/io/VMFile.java b/libjava/classpath/vm/reference/java/io/VMFile.java
index 2a2751765ec..9f584af239e 100644
--- a/libjava/classpath/vm/reference/java/io/VMFile.java
+++ b/libjava/classpath/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