]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/utils.cpp
Updated projects/makefiles
[wxWidgets.git] / src / msw / utils.cpp
index 590486daf8f55fc2438e227b38e203308f8745f4..00ea5c39eba8caf44a437927e2d852034bf93f60 100644 (file)
@@ -61,9 +61,10 @@ extern "C" {
     #endif
 #endif  //GNUWIN32
 
-#if defined(__GNUWIN32__) && !defined(__TWIN32__)
+#if defined(__CYGWIN__) && !defined(__TWIN32__)
     #include <sys/unistd.h>
     #include <sys/stat.h>
+    #include <sys/cygwin.h> // for cygwin_conv_to_full_win32_path()
 #endif  //GNUWIN32
 
 #ifdef __BORLANDC__ // Please someone tell me which version of Borland needs
@@ -372,6 +373,13 @@ const wxChar* wxGetHomeDir(wxString *pstr)
     // add a trailing slash if needed
     if ( strDir.Last() != wxT('/') )
       strDir << wxT('/');
+
+    #ifdef __CYGWIN__
+      // Cygwin returns unix type path but that does not work well
+      static wxChar windowsPath[MAX_PATH];
+      cygwin_conv_to_full_win32_path(strDir, windowsPath);
+      strDir = windowsPath;
+    #endif
   #else   // Windows
     #ifdef  __WIN32__
       const wxChar *szHome = wxGetenv(wxT("HOMEDRIVE"));
@@ -459,10 +467,10 @@ bool wxGetDiskSpace(const wxString& path, wxLongLong *pTotal, wxLongLong *pFree)
     (!defined(__GNUWIN32__) || wxCHECK_W32API_VERSION( 0, 3 ))
     // GetDiskFreeSpaceEx() is not available under original Win95, check for
     // it
-    typedef BOOL (*GetDiskFreeSpaceEx_t)(LPCTSTR,
-                                         PULARGE_INTEGER,
-                                         PULARGE_INTEGER,
-                                         PULARGE_INTEGER);
+    typedef BOOL (WINAPI *GetDiskFreeSpaceEx_t)(LPCTSTR,
+                                                PULARGE_INTEGER,
+                                                PULARGE_INTEGER,
+                                                PULARGE_INTEGER);
 
     GetDiskFreeSpaceEx_t
         pGetDiskFreeSpaceEx = (GetDiskFreeSpaceEx_t)::GetProcAddress
@@ -492,12 +500,12 @@ bool wxGetDiskSpace(const wxString& path, wxLongLong *pTotal, wxLongLong *pFree)
 
         if ( pTotal )
         {
-            *pTotal = wxLongLong(bytesTotal.HighPart, bytesTotal.LowPart);
+            *pTotal = wxLongLong(bytesTotal.u.HighPart, bytesTotal.u.LowPart);
         }
 
         if ( pFree )
         {
-            *pFree = wxLongLong(bytesFree.HighPart, bytesFree.LowPart);
+            *pFree = wxLongLong(bytesFree.u.HighPart, bytesFree.u.LowPart);
         }
     }
     else