From 19e1292d731e6719b6a2f1da4d096fc4b3f55dec Mon Sep 17 00:00:00 2001 From: Angus Leeming Date: Fri, 30 Sep 2005 09:44:37 +0000 Subject: [PATCH] Check for NewAPIs.h. Use it to enable runtime support for Windows95 in Boost.Filesystem. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10499 a592a061-630c-0410-9148-cb99ea01b6c8 --- ChangeLog | 6 +++ boost/ChangeLog | 10 ++++ .../src/operations_posix_windows.cpp | 49 ++++++++++++++++++- configure.ac | 6 ++- 4 files changed, 68 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 229dd985c0..9c6efa5af4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2005-09-30 Angus Leeming + + * configure.ac: check for NewAPIs.h. If found, define the + WANT_GETFILEATTRIBUTESEX_WRAPPER to enable runtime support + for Windows 95 in Boost.Filesystem. + 2005-09-29 Angus Leeming * configure.ac: Use the new MSYS_AC_CANONICAL_PATH to generate diff --git a/boost/ChangeLog b/boost/ChangeLog index 508b5ba8ae..89688b0a68 100644 --- a/boost/ChangeLog +++ b/boost/ChangeLog @@ -1,3 +1,13 @@ +2005-09-30 Angus Leeming + + * libs/filesystem/src/operations_posix_windows.cpp: add a block + of preprocessor code to include NewAPIs.h conditioned on the + WANT_GETFILEATTRIBUTESEX_WRAPPER macro. Enables runtime support + for Windows 95. + (_is_empty, file_size): replace GetFileAttributesExA with the + macro GetFileAttributesEx to enable the stub magic in NewAPIs.h + to work. + 2005-01-05 Lars Gullik Bjønnes * boost/detail/lwm_win32_nt.h: new file diff --git a/boost/libs/filesystem/src/operations_posix_windows.cpp b/boost/libs/filesystem/src/operations_posix_windows.cpp index 55a6a7c89c..a75a1bca8e 100644 --- a/boost/libs/filesystem/src/operations_posix_windows.cpp +++ b/boost/libs/filesystem/src/operations_posix_windows.cpp @@ -46,6 +46,51 @@ namespace fs = boost::filesystem; # if defined(BOOST_WINDOWS) # include "windows.h" + + ////////////////////////////////////////////////////////////////////// + // + // Enable Boost.Filesystem to run on Win95 using the emulation + // of GetFileAttributesEx available in the Microsoft Platform SDK + // header file NewAPIs.h. + // + // The user needs only to define WANT_GETFILEATTRIBUTESEX_WRAPPER + // to enable this emulation. + // + // Please note, however, that this block of preprocessor code enables + // the user to compile against the emulation code. To link the + // executable the user must also compile the function definitions in + // NewAPIs.h. See NewAPIs.h for further details. + // + // This code should work both with Microsoft's native implementation + // of the winapi headers and also with MinGW/Cygwin's version. + // + ////////////////////////////////////////////////////////////////////// +# if defined(WANT_GETFILEATTRIBUTESEX_WRAPPER) +# if (defined(__MINGW__) || defined(__CYGWIN__)) && WINVER < 0x040A + // MinGW/Cygwin's winapi header files and NewAPIs.h do not live + // well together because NewAPIs.h redefines + // WIN32_FILE_ATTRIBUTE_DATA and GET_FILEEX_INFO_LEVELS + // if WINVER < 0x04A. +# include +# if __W32API_MAJOR_VERSION < 3 || \ + __W32API_MAJOR_VERSION == 3 && __W32API_MINOR_VERSION <= 3 +# define BOOST_FILESYSTEM_WINVER WINVER +# undef WINVER +# define WINVER 0x040A +# endif +# endif + +# include + + // Return macro definitions to their original state. +# ifdef BOOST_FILESYSTEM_WINVER +# undef WINVER +# define WINVER BOOST_FILESYSTEM_WINVER +# undef BOOST_FILESYSTEM_WINVER +# endif +# endif + ////////////////////////////////////////////////////////////////////// + # if defined(__BORLANDC__) || defined(__MWERKS__) # if defined(__BORLANDC__) using std::time_t; @@ -391,7 +436,7 @@ namespace boost : path_stat.st_size == 0; # else WIN32_FILE_ATTRIBUTE_DATA fad; - if ( !::GetFileAttributesExA( ph.string().c_str(), + if ( !::GetFileAttributesEx( ph.string().c_str(), ::GetFileExInfoStandard, &fad ) ) boost::throw_exception( filesystem_error( "boost::filesystem::is_empty", @@ -538,7 +583,7 @@ namespace boost # else // by now, intmax_t is 64-bits on all Windows compilers WIN32_FILE_ATTRIBUTE_DATA fad; - if ( !::GetFileAttributesExA( ph.string().c_str(), + if ( !::GetFileAttributesEx( ph.string().c_str(), ::GetFileExInfoStandard, &fad ) ) boost::throw_exception( filesystem_error( "boost::filesystem::file_size", diff --git a/configure.ac b/configure.ac index 2281d12caf..0e22032ade 100644 --- a/configure.ac +++ b/configure.ac @@ -249,7 +249,7 @@ AC_LANG_POP(C) # some standard header files AC_HEADER_DIRENT AC_HEADER_MAJOR -AC_CHECK_HEADERS(sys/time.h sys/types.h sys/select.h strings.h locale.h utime.h sys/utime.h io.h process.h) +AC_CHECK_HEADERS(sys/time.h sys/types.h sys/select.h strings.h locale.h utime.h sys/utime.h io.h process.h NewAPIs.h) # some standard structures AC_HEADER_STAT @@ -407,6 +407,10 @@ int mkstemp(char*); #define BOOST_POSIX 1 #endif +#if defined(HAVE_NEWAPIS_H) +#define WANT_GETFILEATTRIBUTESEX_WRAPPER 1 +#endif + #endif ])