/////////////////////////////////////////////////////////////////////////////
-// Name: filefn.h
+// Name: wx/filefn.h
// Purpose: File- and directory-related functions
// Author: Julian Smart
// Modified by:
#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"
// __OS2__ and __UNIX__ are defined.
#include <process.h>
#include "wx/os2/private.h"
+ #ifdef __WATCOMC__
+ #include <direct.h>
+ #endif
#include <io.h>
#ifdef __EMX__
#include <unistd.h>
#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 <direct.h>
#include <dos.h>
#include <io.h>
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
#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
#define wxWrite ::write
#define wxLseek lseek
#define wxSeek lseek
- #define wxFsync commit
+ #define wxFsync fsync
#define wxEof eof
#define wxMkDir mkdir
#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 <io.h> // 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
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);
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
// 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
// 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.
// 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_