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
This commit is contained in:
Angus Leeming 2005-09-30 09:44:37 +00:00
parent 6ce7fa27f1
commit 19e1292d73
4 changed files with 68 additions and 3 deletions

View File

@ -1,3 +1,9 @@
2005-09-30 Angus Leeming <leeming@lyx.org>
* 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 <leeming@lyx.org>
* configure.ac: Use the new MSYS_AC_CANONICAL_PATH to generate

View File

@ -1,3 +1,13 @@
2005-09-30 Angus Leeming <leeming@lyx.org>
* 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 <larsbj@gullik.net>
* boost/detail/lwm_win32_nt.h: new file

View File

@ -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 <w32api.h>
# 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 <NewAPIs.h>
// 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",

View File

@ -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
])