X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1e6feb95a79834836e88143b15d9f424ebe79621..e126b44d229ae637922a0532c3d11222b024c4a9:/src/unix/utilsunx.cpp diff --git a/src/unix/utilsunx.cpp b/src/unix/utilsunx.cpp index a93c05a3be..3bd19ffbf6 100644 --- a/src/unix/utilsunx.cpp +++ b/src/unix/utilsunx.cpp @@ -28,6 +28,10 @@ #include "wx/stream.h" +#ifdef HAVE_STATFS + #include +#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 // ----------------------------------------------------------------------------