X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/170b04bae6c1ca98bcb62db69f38d7ab0f46c808..9386cb75e34acb49cd9fac945e09cf002f22db2d:/src/common/intl.cpp?ds=inline diff --git a/src/common/intl.cpp b/src/common/intl.cpp index 11c6340293..34e2fc3938 100644 --- a/src/common/intl.cpp +++ b/src/common/intl.cpp @@ -1037,6 +1037,8 @@ static wxString GetFullSearchPath(const wxChar *lang) << wxPATH_SEP; } + // TODO: use wxStandardPaths instead of all this mess!! + // LC_PATH is a standard env var containing the search path for the .mo // files #ifndef __WXWINCE__ @@ -1056,14 +1058,16 @@ static wxString GetFullSearchPath(const wxChar *lang) // then take the current directory // FIXME it should be the directory of the executable -#ifdef __WXMAC__ - wxChar cwd[512] ; - wxGetWorkingDirectory( cwd , sizeof( cwd ) ) ; - searchPath << GetAllMsgCatalogSubdirs(cwd, lang); +#if defined(__WXMAC__) + searchPath << GetAllMsgCatalogSubdirs(wxGetCwd(), lang); // generic search paths could be somewhere in the system folder preferences -#else // !Mac +#elif defined(__WXMSW__) + // look in the directory of the executable + wxString path; + wxSplitPath(wxGetFullModuleName(), &path, NULL, NULL); + searchPath << GetAllMsgCatalogSubdirs(path, lang); +#else // !Mac, !MSW searchPath << GetAllMsgCatalogSubdirs(wxT("."), lang); - #endif // platform return searchPath; @@ -1120,7 +1124,7 @@ bool wxMsgCatalogFile::Load(const wxChar *szDirPrefix, const wxChar *szName0, return false; // get the file size (assume it is less than 4Gb...) - size_t nSize = fileMsg.Length(); + wxFileOffset nSize = fileMsg.Length(); if ( nSize == wxInvalidOffset ) return false; @@ -1132,7 +1136,7 @@ bool wxMsgCatalogFile::Load(const wxChar *szDirPrefix, const wxChar *szName0, } // examine header - bool bValid = nSize > sizeof(wxMsgCatalogHeader); + bool bValid = nSize + (size_t)0 > sizeof(wxMsgCatalogHeader); wxMsgCatalogHeader *pHeader = (wxMsgCatalogHeader *)m_pData; if ( bValid ) {