X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c5ba48512424b7e543cadfccef304fe170bdf910..a3a8d81d487ae4f03d8b70bce20bddbfc48c5776:/src/msw/utils.cpp?ds=sidebyside diff --git a/src/msw/utils.cpp b/src/msw/utils.cpp index 2958f75788..e23656dfa9 100644 --- a/src/msw/utils.cpp +++ b/src/msw/utils.cpp @@ -67,7 +67,9 @@ #if defined(__CYGWIN__) #include #include - #include // for cygwin_conv_to_full_win32_path() + #include // for cygwin_conv_path() + // and cygwin_conv_to_full_win32_path() + #include #endif //GNUWIN32 #ifdef __BORLANDC__ // Please someone tell me which version of Borland needs @@ -367,7 +369,7 @@ const wxChar* wxGetHomeDir(wxString *pstr) // first branch is for Cygwin #if defined(__UNIX__) && !defined(__WINE__) - const wxChar *szHome = wxGetenv("HOME"); + const wxChar *szHome = wxGetenv(wxT("HOME")); if ( szHome == NULL ) { // we're homeless... wxLogWarning(_("can't find user's HOME, using current directory.")); @@ -383,7 +385,11 @@ const wxChar* wxGetHomeDir(wxString *pstr) #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); + #if CYGWIN_VERSION_DLL_MAJOR >= 1007 + cygwin_conv_path(CCP_POSIX_TO_WIN_W, strDir, windowsPath, MAX_PATH); + #else + cygwin_conv_to_full_win32_path(strDir, windowsPath); + #endif strDir = windowsPath; #endif #elif defined(__WXWINCE__) @@ -494,7 +500,7 @@ bool wxGetDiskSpace(const wxString& WXUNUSED_IN_WINCE(path), ULARGE_INTEGER bytesFree, bytesTotal; // may pass the path as is, GetDiskFreeSpaceEx() is smart enough - if ( !pGetDiskFreeSpaceEx(path.fn_str(), + if ( !pGetDiskFreeSpaceEx(path.t_str(), &bytesFree, &bytesTotal, NULL) ) @@ -544,7 +550,7 @@ bool wxGetDiskSpace(const wxString& WXUNUSED_IN_WINCE(path), // FIXME: this is wrong, we should extract the root drive from path // instead, but this is the job for wxFileName... - if ( !::GetDiskFreeSpace(path.fn_str(), + if ( !::GetDiskFreeSpace(path.t_str(), &lSectorsPerCluster, &lBytesPerSector, &lNumberOfFreeClusters, @@ -1085,17 +1091,18 @@ bool wxLoadUserResource(const void **outData, size_t *outLen, const wxString& resourceName, - const wxString& resourceType) + const wxString& resourceType, + WXHINSTANCE instance) { wxCHECK_MSG( outData && outLen, false, "output pointers can't be NULL" ); - HRSRC hResource = ::FindResource(wxGetInstance(), + HRSRC hResource = ::FindResource(instance, resourceName.wx_str(), resourceType.wx_str()); if ( !hResource ) return false; - HGLOBAL hData = ::LoadResource(wxGetInstance(), hResource); + HGLOBAL hData = ::LoadResource(instance, hResource); if ( !hData ) { wxLogSysError(_("Failed to load resource \"%s\"."), resourceName); @@ -1109,7 +1116,7 @@ wxLoadUserResource(const void **outData, return false; } - *outLen = ::SizeofResource(wxGetInstance(), hResource); + *outLen = ::SizeofResource(instance, hResource); // Notice that we do not need to call neither UnlockResource() (which is // obsolete in Win32) nor GlobalFree() (resources are freed on process @@ -1121,11 +1128,12 @@ wxLoadUserResource(const void **outData, char * wxLoadUserResource(const wxString& resourceName, const wxString& resourceType, - int* pLen) + int* pLen, + WXHINSTANCE instance) { const void *data; size_t len; - if ( !wxLoadUserResource(&data, &len, resourceName, resourceType) ) + if ( !wxLoadUserResource(&data, &len, resourceName, resourceType, instance) ) return NULL; char *s = new char[len + 1];