X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e2fc40b4786f7ae8c255ce1184441bd94d9554a0..8a2e3f80f67b0716b3d1854418b187943dcff11a:/include/wx/filefn.h diff --git a/include/wx/filefn.h b/include/wx/filefn.h index a36505eb1c..01b9c03a82 100644 --- a/include/wx/filefn.h +++ b/include/wx/filefn.h @@ -60,7 +60,7 @@ #endif #if defined(__WINDOWS__) && !defined(__WXMICROWIN__) -#if !defined( __GNUWIN32__ ) && !defined( __MWERKS__ ) && !defined(__SALFORDC__) && !defined(__WXWINCE__) && !defined(__CYGWIN__) +#if !defined( __GNUWIN32__ ) && !defined( __MWERKS__ ) && !defined(__WXWINCE__) && !defined(__CYGWIN__) #include #include #include @@ -85,11 +85,6 @@ #include #endif -#ifdef __SALFORDC__ - #include - #include -#endif - #ifndef __WXPALMOS5__ #ifndef __WXWINCE__ #include // O_RDONLY &c @@ -168,6 +163,7 @@ enum wxFileKind #elif (defined(__WXMSW__) || defined(__OS2__)) && !defined(__WXPALMOS__) && \ ( \ defined(__VISUALC__) || \ + defined(__MINGW64__) || \ (defined(__MINGW32__) && !defined(__WINE__) && \ wxCHECK_W32API_VERSION(0, 5)) || \ defined(__MWERKS__) || \ @@ -181,7 +177,7 @@ enum wxFileKind // detect compilers which have support for huge files #if defined(__VISUALC__) #define wxHAS_HUGE_FILES 1 - #elif defined(__MINGW32__) + #elif defined(__MINGW32__) || defined(__MINGW64__) #define wxHAS_HUGE_FILES 1 #elif defined(_LARGE_FILES) #define wxHAS_HUGE_FILES 1 @@ -207,7 +203,7 @@ enum wxFileKind // to avoid using them as they're not present in earlier versions and // always using the native functions spelling is easier than testing for // the versions - #if defined(__BORLANDC__) || defined(__DMC__) || defined(__WATCOMC__) + #if defined(__BORLANDC__) || defined(__DMC__) || defined(__WATCOMC__) || defined(__MINGW64__) #define wxPOSIX_IDENT(func) ::func #else // by default assume MSVC-compatible names #define wxPOSIX_IDENT(func) _ ## func @@ -242,9 +238,16 @@ enum wxFileKind #endif #ifdef wxHAS_HUGE_FILES - #define wxSeek wxPOSIX_IDENT(lseeki64) - #define wxLseek wxPOSIX_IDENT(lseeki64) - #define wxTell wxPOSIX_IDENT(telli64) + #ifndef __MINGW64__ + #define wxSeek wxPOSIX_IDENT(lseeki64) + #define wxLseek wxPOSIX_IDENT(lseeki64) + #define wxTell wxPOSIX_IDENT(telli64) + #else + // unfortunately, mingw-W64 is somewhat inconsistent... + #define wxSeek _lseeki64 + #define wxLseek _lseeki64 + #define wxTell _telli64 + #endif #else // !wxHAS_HUGE_FILES #define wxSeek wxPOSIX_IDENT(lseek) #define wxLseek wxPOSIX_IDENT(lseek) @@ -252,12 +255,15 @@ enum wxFileKind #endif // wxHAS_HUGE_FILES/!wxHAS_HUGE_FILES #ifndef __WATCOMC__ - #if !defined(__BORLANDC__) || (__BORLANDC__ > 0x540) - // NB: this one is not POSIX and always has the underscore - #define wxFsync _commit - - #define HAVE_FSYNC - #endif // BORLANDC + #if !defined(__BORLANDC__) || (__BORLANDC__ > 0x540) + // NB: this one is not POSIX and always has the underscore + #define wxFsync _commit + + // could be already defined by configure (Cygwin) + #ifndef HAVE_FSYNC + #define HAVE_FSYNC + #endif + #endif // BORLANDC #endif #define wxEof wxPOSIX_IDENT(eof) @@ -343,20 +349,31 @@ enum wxFileKind // Types: Notice that Watcom is the only compiler to have a wide char // version of struct stat as well as a wide char stat function variant. - // This was droped since OW 1.4 "for consistency across platforms". - #ifdef wxHAS_HUGE_FILES - #if wxUSE_UNICODE && wxONLY_WATCOM_EARLIER_THAN(1,4) - #define wxStructStat struct _wstati64 + // This was dropped since OW 1.4 "for consistency across platforms". + // + // Borland is also special in that it uses _stat with Unicode functions + // (for MSVC compatibility?) but stat with ANSI ones + #ifdef __BORLANDC__ + #if wxUSE_UNICODE + #define wxStructStat struct _stat #else - #define wxStructStat struct _stati64 + #define wxStructStat struct stat #endif - #else - #if wxUSE_UNICODE && wxONLY_WATCOM_EARLIER_THAN(1,4) - #define wxStructStat struct _wstat + #else // !__BORLANDC__ + #ifdef wxHAS_HUGE_FILES + #if wxUSE_UNICODE && wxONLY_WATCOM_EARLIER_THAN(1,4) + #define wxStructStat struct _wstati64 + #else + #define wxStructStat struct _stati64 + #endif #else - #define wxStructStat struct _stat + #if wxUSE_UNICODE && wxONLY_WATCOM_EARLIER_THAN(1,4) + #define wxStructStat struct _wstat + #else + #define wxStructStat struct _stat + #endif #endif - #endif + #endif // __BORLANDC__/!__BORLANDC__ // constants (unless already defined by the user code) #ifdef wxHAS_UNDERSCORES_IN_POSIX_IDENTS @@ -387,6 +404,43 @@ enum wxFileKind // it's a private define, undefine it so that nobody gets tempted to use it #undef wxHAS_HUGE_FILES +#elif defined (__WXPALMOS__) + typedef off_t wxFileOffset; +#ifdef _LARGE_FILES + #define wxFileOffsetFmtSpec wxLongLongFmtSpec + wxCOMPILE_TIME_ASSERT( sizeof(off_t) == sizeof(wxLongLong_t), BadFileSizeType ); + // wxFile is present and supports large files + #ifdef wxUSE_FILE + #define wxHAS_LARGE_FILES + #endif + // wxFFile is present and supports large files + #if SIZEOF_LONG == 8 || defined HAVE_FSEEKO + #define wxHAS_LARGE_FFILES + #endif +#else + #define wxFileOffsetFmtSpec _T("") +#endif + #define wxClose close + #define wxRead ::read + #define wxWrite ::write + #define wxLseek lseek + #define wxSeek lseek + #define wxFsync fsync + #define wxEof eof + + #define wxCRT_MkDir mkdir + #define wxCRT_RmDir rmdir + + #define wxTell(fd) lseek(fd, 0, SEEK_CUR) + + #define wxStructStat struct stat + + #define wxCRT_Open open + #define wxCRT_Stat svfs_stat + #define wxCRT_Lstat lstat + #define wxCRT_Access access + + #define wxHAS_NATIVE_LSTAT #else // Unix or Windows using unknown compiler, assume POSIX supported typedef off_t wxFileOffset; #ifdef _LARGE_FILES @@ -489,41 +543,49 @@ WXDLLIMPEXP_BASE wxString wxFileNameFromPath(const wxString& path); // Get directory WXDLLIMPEXP_BASE wxString wxPathOnly(const wxString& path); -WXDLLIMPEXP_BASE void wxDos2UnixFilename(char *s); -WXDLLIMPEXP_BASE void wxDos2UnixFilename(wchar_t *s); +// all deprecated functions below are deprecated in favour of wxFileName's methods +#if WXWIN_COMPATIBILITY_2_8 + +wxDEPRECATED( WXDLLIMPEXP_BASE void wxDos2UnixFilename(char *s) ); +wxDEPRECATED( WXDLLIMPEXP_BASE void wxDos2UnixFilename(wchar_t *s) ); -WXDLLIMPEXP_BASE void wxUnix2DosFilename(char *s); -WXDLLIMPEXP_BASE void wxUnix2DosFilename(wchar_t *s); +wxDEPRECATED( WXDLLIMPEXP_BASE void wxUnix2DosFilename(char *s) ); +wxDEPRECATED( WXDLLIMPEXP_BASE void wxUnix2DosFilename(wchar_t *s) ); // Strip the extension, in situ -WXDLLIMPEXP_BASE void wxStripExtension(char *buffer); -WXDLLIMPEXP_BASE void wxStripExtension(wchar_t *buffer); -WXDLLIMPEXP_BASE void wxStripExtension(wxString& buffer); +wxDEPRECATED( WXDLLIMPEXP_BASE void wxStripExtension(char *buffer) ); +wxDEPRECATED( WXDLLIMPEXP_BASE void wxStripExtension(wchar_t *buffer) ); +wxDEPRECATED( WXDLLIMPEXP_BASE void wxStripExtension(wxString& buffer) ); + // DEPRECATED: construct a wxFileName, use ClearExt() and then GetFullPath() // Get a temporary filename -WXDLLIMPEXP_BASE wxChar* wxGetTempFileName(const wxString& prefix, wxChar *buf = (wxChar *) NULL); -WXDLLIMPEXP_BASE bool wxGetTempFileName(const wxString& prefix, wxString& buf); +wxDEPRECATED_BUT_USED_INTERNALLY( WXDLLIMPEXP_BASE wxChar* wxGetTempFileName(const wxString& prefix, wxChar *buf = (wxChar *) NULL) ); +wxDEPRECATED_BUT_USED_INTERNALLY( WXDLLIMPEXP_BASE bool wxGetTempFileName(const wxString& prefix, wxString& buf) ); // Expand file name (~/ and ${OPENWINHOME}/ stuff) -WXDLLIMPEXP_BASE char* wxExpandPath(char *dest, const wxString& path); -WXDLLIMPEXP_BASE wchar_t* wxExpandPath(wchar_t *dest, const wxString& path); -// FIXME-UTF8: add some wxString version +wxDEPRECATED_BUT_USED_INTERNALLY( WXDLLIMPEXP_BASE char* wxExpandPath(char *dest, const wxString& path) ); +wxDEPRECATED_BUT_USED_INTERNALLY( WXDLLIMPEXP_BASE wchar_t* wxExpandPath(wchar_t *dest, const wxString& path) ); + // DEPRECATED: use wxFileName::Normalize(wxPATH_NORM_ENV_VARS) // Contract w.r.t environment ( -> ${OPENWINHOME}/lib) // and make (if under the home tree) relative to home // [caller must copy-- volatile] +wxDEPRECATED( WXDLLIMPEXP_BASE wxChar* wxContractPath(const wxString& filename, const wxString& envname = wxEmptyString, - const wxString& user = wxEmptyString); + const wxString& user = wxEmptyString) ); + // DEPRECATED: use wxFileName::ReplaceEnvVariable and wxFileName::ReplaceHomeDir // Destructive removal of /./ and /../ stuff -// FIXME-UTF8: deprecate these two (and similar) -WXDLLIMPEXP_BASE char* wxRealPath(char *path); -WXDLLIMPEXP_BASE wchar_t* wxRealPath(wchar_t *path); -WXDLLIMPEXP_BASE wxString wxRealPath(const wxString& path); +wxDEPRECATED_BUT_USED_INTERNALLY( WXDLLIMPEXP_BASE char* wxRealPath(char *path) ); +wxDEPRECATED_BUT_USED_INTERNALLY( WXDLLIMPEXP_BASE wchar_t* wxRealPath(wchar_t *path) ); +wxDEPRECATED_BUT_USED_INTERNALLY( WXDLLIMPEXP_BASE wxString wxRealPath(const wxString& path) ); + // DEPRECATED: use wxFileName::Normalize instead // Allocate a copy of the full absolute path -WXDLLIMPEXP_BASE wxChar* wxCopyAbsolutePath(const wxString& path); +wxDEPRECATED( WXDLLIMPEXP_BASE wxChar* wxCopyAbsolutePath(const wxString& path) ); + // DEPRECATED: use wxFileName::MakeAbsolute instead +#endif // Get first file name matching given wild card. // Flags are reserved for future use. @@ -654,12 +716,14 @@ inline bool wxIsPathSeparator(wxChar c) // does the string ends with path separator? WXDLLIMPEXP_BASE bool wxEndsWithPathSeparator(const wxString& filename); +#if WXWIN_COMPATIBILITY_2_8 // split the full path into path (including drive for DOS), name and extension // (understands both '/' and '\\') -WXDLLIMPEXP_BASE void wxSplitPath(const wxString& fileName, - wxString *pstrPath, - wxString *pstrName, - wxString *pstrExt); +wxDEPRECATED( WXDLLIMPEXP_BASE void wxSplitPath(const wxString& fileName, + wxString *pstrPath, + wxString *pstrName, + wxString *pstrExt) ); +#endif // find a file in a list of directories, returns false if not found WXDLLIMPEXP_BASE bool wxFindFileInPath(wxString *pStr, const wxString& szPath, const wxString& szFile);