This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [classpath-095-merge-branch] implement java.io.File methods


Tom Tromey schrieb:
>>>>>> "Matthias" == Matthias Klose <doko@ubuntu.com> writes:
> 
> Matthias> This patch implements the native support for new methods in
> Matthias> java.io.File.  Checked in to the classpath-095-merge-branch.
> 
> Matthias> Missing are the native changes for natFileWin32.cc (only
> Matthias> natFilePosix.cc done).
> 
> Maybe you could add stubs to the other File implementations that throw
> an exception, just so we can keep them linking for the time being.
> Mohan, could you try a patch if Matthias (or someone :) wrote one?  Or
> would you prefer it if the work simply went in on trunk, temporarily
> breaking the Windows build?

Checked in the following dummy implementations on the merge branch, so the build
should not break.

  Matthias


2007-05-24  Matthias Klose  <doko@ubuntu.com>

	* java/io/natFileWin32.cc (setFilePermissions): New (stub only).
	_access: Handle EXEC query, stub only.
 
Index: java/io/natFileWin32.cc
===================================================================
--- java/io/natFileWin32.cc	(revision 124801)
+++ java/io/natFileWin32.cc	(working copy)
@@ -44,13 +44,17 @@
   if (!canon)
     return false;
 
-  JvAssert (query == READ || query == WRITE || query == EXISTS);
+  JvAssert (query == READ || query == WRITE || query == EXISTS
+	    || query == EXEC);
 
   // FIXME: Is it possible to differentiate between existing and reading?
   // If the file exists but cannot be read because of the secuirty attributes
   // on an NTFS disk this wont work (it reports it can be read but cant)
   // Could we use something from the security API?
   DWORD attributes = GetFileAttributes (canon);
+  // FIXME: handle EXEC
+  if (query == EXEC)
+    return false;
   if ((query == EXISTS) || (query == READ))
     return (attributes == 0xffffffff) ? false : true;
   else
@@ -212,6 +216,25 @@
 }
 
 jboolean
+java::io::File::setFilePermissions (jboolean enable,
+				    jboolean ownerOnly,
+				    jint permissions)
+{
+  JV_TEMP_STRING_WIN32 (canon, getCanonicalPath());
+  if (!canon)
+    return false;
+
+  DWORD attrs = GetFileAttributes (canon);
+  if (attrs != INVALID_FILE_ATTRIBUTES)
+    {
+      // FIXME: implement
+      return false;
+    }
+  else
+    return false;
+}
+
+jboolean
 java::io::File::performMkdir (void)
 {
   JV_TEMP_STRING_WIN32 (cpath, path);

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]