]> git.saurik.com Git - wxWidgets.git/blobdiff - src/unix/utilsunx.cpp
added error message in case older apple header files are used
[wxWidgets.git] / src / unix / utilsunx.cpp
index a93c05a3be1d07e5e4b10cc731bfb360de67318b..3bd19ffbf6a38d18bd3c3ed5c44abebd7794f852 100644 (file)
 
 #include "wx/stream.h"
 
+#ifdef HAVE_STATFS
+    #include <sys/vfs.h>
+#endif // HAVE_STATFS
+
 #if wxUSE_GUI
     #include "wx/unix/execute.h"
 #endif
@@ -608,7 +612,7 @@ long wxExecute(wxChar **argv,
             close(pipeErr[1]); // close writing side
         }
 
-#if wxUSE_GUI
+#if wxUSE_GUI && !defined(__WXMICROWIN__)
         wxEndProcessData *data = new wxEndProcessData;
 
         if ( sync )
@@ -909,6 +913,34 @@ long wxGetFreeMemory()
     return -1;
 }
 
+bool wxGetDiskSpace(const wxString& path, wxLongLong *pTotal, wxLongLong *pFree)
+{
+#ifdef HAVE_STATFS
+
+    struct statfs fs;
+    if ( statfs(path, &fs) != 0 )
+    {
+        wxLogSysError("Failed to get file system statistics");
+
+        return FALSE;
+    }
+
+    if ( pTotal )
+    {
+        *pTotal = wxLongLong(fs.f_blocks) * fs.f_bsize;
+    }
+
+    if ( pFree )
+    {
+        *pFree = wxLongLong(fs.f_bavail) * fs.f_bsize;
+    }
+
+    return TRUE;
+#endif // HAVE_STATFS
+
+    return FALSE;
+}
+
 // ----------------------------------------------------------------------------
 // env vars
 // ----------------------------------------------------------------------------