X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5c7022599b0369c92c3afefab60928a7b1a9fcee..aa017eabe201ae64903d9267251679274c305e1a:/include/wx/filefn.h diff --git a/include/wx/filefn.h b/include/wx/filefn.h index 871ed8c932..5839b81095 100644 --- a/include/wx/filefn.h +++ b/include/wx/filefn.h @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: filefn.h +// Name: wx/filefn.h // Purpose: File- and directory-related functions // Author: Julian Smart // Modified by: @@ -12,10 +12,6 @@ #ifndef _FILEFN_H_ #define _FILEFN_H_ -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) - #pragma interface "filefn.h" -#endif - #include "wx/list.h" #include "wx/arrstr.h" @@ -49,6 +45,9 @@ // __OS2__ and __UNIX__ are defined. #include #include "wx/os2/private.h" + #ifdef __WATCOMC__ + #include + #endif #include #ifdef __EMX__ #include @@ -59,7 +58,7 @@ #endif #if defined(__WINDOWS__) && !defined(__WXMICROWIN__) -#if !defined( __GNUWIN32__ ) && !defined( __MWERKS__ ) && !defined(__SALFORDC__) && !defined(__WXWINCE__) +#if !defined( __GNUWIN32__ ) && !defined( __MWERKS__ ) && !defined(__SALFORDC__) && !defined(__WXWINCE__) && !defined(__CYGWIN__) #include #include #include @@ -148,10 +147,9 @@ enum wxFileKind int wxWrite(int fd, const void *buf, unsigned int count); int wxEof(int fd); wxFileOffset wxSeek(int fd, wxFileOffset offset, int origin); - inline HANDLE wxGetOSFHandle(int fd) { return (HANDLE)fd; } #define wxLSeek wxSeek wxFileOffset wxTell(int fd); - + // always Unicode under WinCE #define wxMkDir _wmkdir #define wxRmDir _wrmdir @@ -276,16 +274,17 @@ enum wxFileKind #endif #endif - // 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 + // 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". #if wxHAS_HUGE_FILES - #if wxUSE_UNICODE && defined(__WATCOMC__) + #if wxUSE_UNICODE && wxONLY_WATCOM_EARLIER_THAN(1,4) #define wxStructStat struct _wstati64 #else #define wxStructStat struct _stati64 #endif #else - #if wxUSE_UNICODE && defined(__WATCOMC__) + #if wxUSE_UNICODE && wxONLY_WATCOM_EARLIER_THAN(1,4) #define wxStructStat struct _wstat #else #define wxStructStat struct _stat @@ -327,7 +326,7 @@ enum wxFileKind #define wxWrite ::write #define wxLseek lseek #define wxSeek lseek - #define wxFsync commit + #define wxFsync fsync #define wxEof eof #define wxMkDir mkdir @@ -352,20 +351,6 @@ enum wxFileKind #endif #endif // platforms -#if defined(__WXMSW__) && !defined(__WXWINCE__) - // get the HANDLE associated with a file descriptor -# ifdef __CYGWIN__ -# include "wx/msw/private.h" // for HANDLE -# include // for get_osfhandle() - inline HANDLE wxGetOSFHandle(int fd) { return (HANDLE) get_osfhandle(fd); } -# else -# ifdef __BORLANDC__ -# include "wx/msw/private.h" // for HANDLE -# endif - inline HANDLE wxGetOSFHandle(int fd) { return (HANDLE) _get_osfhandle(fd); } -# endif -#endif - #if defined(__VISAGECPP__) && __IBMCPP__ >= 400 // // VisualAge C++ V4.0 cannot have any external linkage const decs @@ -382,7 +367,7 @@ const int wxInvalidOffset = -1; WXDLLIMPEXP_BASE bool wxFileExists(const wxString& filename); // does the path exist? (may have or not '/' or '\\' at the end) -WXDLLIMPEXP_BASE bool wxPathExists(const wxChar *pszPathName); +WXDLLIMPEXP_BASE bool wxDirExists(const wxChar *pszPathName); WXDLLIMPEXP_BASE bool wxIsAbsolutePath(const wxString& filename); @@ -451,16 +436,18 @@ WXDLLIMPEXP_BASE bool wxCopyFile(const wxString& file1, const wxString& file2, WXDLLIMPEXP_BASE bool wxRemoveFile(const wxString& file); // Rename file -WXDLLIMPEXP_BASE bool wxRenameFile(const wxString& file1, const wxString& file2); +WXDLLIMPEXP_BASE bool wxRenameFile(const wxString& file1, const wxString& file2, bool overwrite = true); // Get current working directory. +#if WXWIN_COMPATIBILITY_2_6 // If buf is NULL, allocates space using new, else // copies into buf. // IMPORTANT NOTE getcwd is know not to work under some releases // of Win32s 1.3, according to MS release notes! -WXDLLIMPEXP_BASE wxChar* wxGetWorkingDirectory(wxChar *buf = (wxChar *) NULL, int sz = 1000); +wxDEPRECATED( WXDLLIMPEXP_BASE wxChar* wxGetWorkingDirectory(wxChar *buf = (wxChar *) NULL, int sz = 1000) ); // new and preferred version of wxGetWorkingDirectory // NB: can't have the same name because of overloading ambiguity +#endif // WXWIN_COMPATIBILITY_2_6 WXDLLIMPEXP_BASE wxString wxGetCwd(); // Set working directory @@ -474,10 +461,16 @@ WXDLLIMPEXP_BASE bool wxRmdir(const wxString& dir, int flags = 0); // Return the type of an open file WXDLLIMPEXP_BASE wxFileKind wxGetFileKind(int fd); -inline wxFileKind wxGetFileKind (FILE *fp) { return wxGetFileKind(fileno(fp)); } +WXDLLIMPEXP_BASE wxFileKind wxGetFileKind(FILE *fp); +#if WXWIN_COMPATIBILITY_2_6 // compatibility defines, don't use in new code -#define wxDirExists wxPathExists +wxDEPRECATED( inline bool wxPathExists(const wxChar *pszPathName) ); +inline bool wxPathExists(const wxChar *pszPathName) +{ + return wxDirExists(pszPathName); +} +#endif //WXWIN_COMPATIBILITY_2_6 // ---------------------------------------------------------------------------- // separators in file names @@ -552,9 +545,13 @@ WXDLLIMPEXP_BASE bool wxFindFileInPath(wxString *pStr, const wxChar *pszPath, co // On non-Windows platform, probably just return the empty string. WXDLLIMPEXP_BASE wxString wxGetOSDirectory(); +#if wxUSE_DATETIME + // Get file modification time WXDLLIMPEXP_BASE time_t wxFileModificationTime(const wxString& filename); +#endif // wxUSE_DATETIME + // Parses the wildCard, returning the number of filters. // Returns 0 if none or if there's a problem, // The arrays will contain an equal number of items found before the error. @@ -602,29 +599,32 @@ private: // Path searching -class WXDLLIMPEXP_BASE wxPathList : public wxStringList +class WXDLLIMPEXP_BASE wxPathList : public wxArrayString { public: - // avoid GCC warning about virtual functions w/o virtual dtor - virtual ~wxPathList() {} + wxPathList() {} + wxPathList(const wxArrayString &arr) + { Add(arr); } // Adds all paths in environment variable void AddEnvList(const wxString& envVariable); + // Adds given path to this list void Add(const wxString& path); + void Add(const wxArrayString &paths); + // Find the first full path for which the file exists - wxString FindValidPath(const wxString& filename); + wxString FindValidPath(const wxString& filename) const; + // Find the first full path for which the file exists; ensure it's an // absolute path that gets returned. - wxString FindAbsoluteValidPath(const wxString& filename); + wxString FindAbsoluteValidPath(const wxString& filename) const; + // Given full path and filename, add path to list void EnsureFileAccessible(const wxString& path); - // Returns true if the path is in the list - bool Member(const wxString& path); -private: - // DECLARE_DYNAMIC_CLASS(wxPathList) + // Returns true if the path is in the list + wxDEPRECATED( bool Member(const wxString& path) const ); }; -#endif - // _WX_FILEFN_H_ +#endif // _WX_FILEFN_H_