[PATCH] GetFileAttributesEx not present on Win95

Ranjit Mathew rmathew@hotmail.com
Mon Oct 21 21:55:00 GMT 2002


Adam Megacz wrote:
> I'll commit it for you; post the full patch with a ChangeLog entry.

A thing to note is that fortunately the
WIN32_FILE_ATTRIBUTE_DATA and the WIN32_FIND_DATA
structs in Win32 contain the same (relevant to this part)
fields with the same name, type and semantics. That's
why the patch affects only a few lines.

ChangeLog:
-------------------------------- 8< -----------------------------------
2002-10-22  Ranjit Mathew <rmathew@hotmail.com>

         * java/io/natFileWin32.cc (attr): Use
         FindFirstFile( ) instead of GetFileAttributesEx( )
         to find file length and modification times, as the
         latter is not present on Windows 95.
-------------------------------- 8< -----------------------------------

Patch:
-------------------------------- 8< -----------------------------------
--- natFileWin32.cc     Sun Oct 20 22:59:12 2002
+++ natFileWin32.cc     Mon Oct 21 00:22:18 2002
@@ -84,7 +84,10 @@
    JvAssert (query == MODIFIED || query == LENGTH);

-  WIN32_FILE_ATTRIBUTE_DATA info;
-  if (! GetFileAttributesEx(buf, GetFileExInfoStandard, &info))
+  WIN32_FIND_DATA info;
+  HANDLE sHandle;
+  if ( ( sHandle = FindFirstFile( buf, &info)) == INVALID_HANDLE_VALUE)
      return 0;
+
+  FindClose( sHandle);

    if (query == LENGTH)
-------------------------------- 8< -----------------------------------

Ranjit.

-- 
Ranjit Mathew          Email: rmathew AT hotmail DOT com

Bangalore, INDIA.      Web: http://ranjitmathew.tripod.com/





More information about the Java-patches mailing list