X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c801d85f158c4cba50b588807daabdcbd0ed3853..c86f1403c3737c07d58676a203f4707942684a01:/include/wx/filefn.h diff --git a/include/wx/filefn.h b/include/wx/filefn.h index 64ff0521de..eb3eb478f6 100644 --- a/include/wx/filefn.h +++ b/include/wx/filefn.h @@ -6,18 +6,40 @@ // Created: 29/01/98 // RCS-ID: $Id$ // Copyright: (c) 1998 Julian Smart -// Licence: wxWindows license +// Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// -#ifndef __FILEFNH__ -#define __FILEFNH__ +#ifndef _FILEFN_H_ +#define _FILEFN_H_ #ifdef __GNUG__ #pragma interface "filefn.h" #endif -#include "wx/list.h" +#include +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +// define off_t +#include + +#ifdef _MSC_VER + #define off_t _off_t +#endif + +const off_t wxInvalidOffset = (off_t)-1; + +typedef enum { + wxFromStart, + wxFromCurrent, + wxFromEnd +} wxSeekMode; + +// ---------------------------------------------------------------------------- +// functions +// ---------------------------------------------------------------------------- bool WXDLLEXPORT wxFileExists(const wxString& filename); #define FileExists wxFileExists @@ -51,6 +73,7 @@ void WXDLLEXPORT wxUnix2DosFilename(char *s); // Strip the extension, in situ void WXDLLEXPORT wxStripExtension(char *buffer); +void WXDLLEXPORT wxStripExtension(wxString& buffer); // Get a temporary filename, opening and closing the file. char* WXDLLEXPORT wxGetTempFileName(const wxString& prefix, char *buf = NULL); @@ -133,6 +156,14 @@ bool WXDLLEXPORT wxRmdir(const wxString& dir, int flags = 0); #define PATH_SEP PATH_SEP_DOS #endif // Unix/Windows +// this is useful for wxString::IsSameAs(): to compare two file names use +// filename1.IsSameAs(filename2, wxARE_FILENAMES_CASE_SENSITIVE) +#ifdef __UNIX__ + #define wxARE_FILENAMES_CASE_SENSITIVE TRUE +#else // Windows + #define wxARE_FILENAMES_CASE_SENSITIVE FALSE +#endif // Unix/Windows + // is the char a path separator? inline bool wxIsPathSeparator(char c) { return c == FILE_SEP_PATH_DOS || c == FILE_SEP_PATH_UNIX; } @@ -140,9 +171,20 @@ inline bool wxIsPathSeparator(char c) // does the string ends with path separator? bool WXDLLEXPORT wxEndsWithPathSeparator(const char *pszFileName); +// split the full path into path (including drive for DOS), name and extension +// (understands both '/' and '\\') +void WXDLLEXPORT wxSplitPath(const char *pszFileName, + wxString *pstrPath, + wxString *pstrName, + wxString *pstrExt); + // find a file in a list of directories, returns false if not found bool WXDLLEXPORT wxFindFileInPath(wxString *pStr, const char *pszPath, const char *pszFile); +// ---------------------------------------------------------------------------- +// classes +// ---------------------------------------------------------------------------- + // Path searching class WXDLLEXPORT wxPathList: public wxStringList { @@ -162,5 +204,5 @@ class WXDLLEXPORT wxPathList: public wxStringList }; #endif - // __FILEFNH__ + // _WX_FILEFN_H_