]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/filefn.h
Added GetTempDir
[wxWidgets.git] / include / wx / filefn.h
index 4189de1bf108966cff69854f5d41db45f39b9f10..5cdc93b404cfd7800f382193353b702bdd00f781 100644 (file)
@@ -309,6 +309,15 @@ enum wxFileKind
         #endif
     #endif
 
+    #if wxHAS_HUGE_FILES
+        // wxFile is present and supports large files. Currently wxFFile
+        // doesn't have large file support with any Windows compiler (even
+        // Win64 ones).
+        #if wxUSE_FILE
+            #define WXFILE_LARGEFILE 1
+        #endif
+    #endif
+        
     // It's a private define, undefine it so nobody gets tempted to use it
     #undef wxHAS_HUGE_FILES
 #else // Unix platforms using configure
@@ -317,6 +326,14 @@ enum wxFileKind
         #define wxFileOffsetFmtSpec wxLongLongFmtSpec
         wxCOMPILE_TIME_ASSERT( sizeof(off_t) == sizeof(wxLongLong_t),
                                 BadFileSizeType );
+        // wxFile is present and supports large files
+        #ifdef wxUSE_FILE
+            #define WXFILE_LARGEFILE
+        #endif
+        // wxFFile is present and supports large files
+        #if SIZEOF_LONG == 8 || defined HAVE_FSEEKO
+            #define WXFFILE_LARGEFILE
+        #endif
     #else
         #define wxFileOffsetFmtSpec _T("")
     #endif
@@ -342,15 +359,31 @@ enum wxFileKind
             typedef unsigned long mode_t;
         #endif
         WXDLLIMPEXP_BASE int wxStat( const wxChar *file_name, wxStructStat *buf );
+        WXDLLIMPEXP_BASE int wxLstat( const wxChar *file_name, wxStructStat *buf );
         WXDLLIMPEXP_BASE int wxAccess( const wxChar *pathname, int mode );
         WXDLLIMPEXP_BASE int wxOpen( const wxChar *pathname, int flags, mode_t mode );
     #else
         #define   wxOpen       open
         #define   wxStat       stat
+        #define   wxLstat      lstat
         #define   wxAccess     access
     #endif
+
+    #define wxHAVE_NATIVE_LSTAT
 #endif // platforms
 
+#ifdef O_BINARY
+    #define wxO_BINARY O_BINARY
+#else
+    #define wxO_BINARY 0
+#endif
+
+// if the platform doesn't have symlinks, define wxLstat to be the same as
+// wxStat to avoid #ifdefs in the code using it
+#ifndef wxHAVE_NATIVE_LSTAT
+    #define wxLstat wxStat
+#endif
+
 #if defined(__VISAGECPP__) && __IBMCPP__ >= 400
 //
 // VisualAge C++ V4.0 cannot have any external linkage const decs
@@ -436,7 +469,7 @@ 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
@@ -472,6 +505,11 @@ inline bool wxPathExists(const wxChar *pszPathName)
 }
 #endif //WXWIN_COMPATIBILITY_2_6
 
+// permissions; these functions work both on files and directories:
+WXDLLIMPEXP_BASE bool wxIsWritable(const wxString &path);
+WXDLLIMPEXP_BASE bool wxIsReadable(const wxString &path);
+WXDLLIMPEXP_BASE bool wxIsExecutable(const wxString &path);
+
 // ----------------------------------------------------------------------------
 // separators in file names
 // ----------------------------------------------------------------------------
@@ -545,9 +583,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.
@@ -595,29 +637,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_