X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ac57418f39e9671c18b99942180563146625d3ae..1f2f0331455e0a91fdbc57afefe8f8c7c0db9392:/src/common/config.cpp diff --git a/src/common/config.cpp b/src/common/config.cpp index 2d5dde5016..9551a9b94c 100644 --- a/src/common/config.cpp +++ b/src/common/config.cpp @@ -19,6 +19,10 @@ #include "wx/wxprec.h" +#ifndef WX_PRECOMP +#include "wx/wx.h" +#endif + #include #ifdef wxUSE_CONFIG @@ -27,11 +31,6 @@ #pragma hdrstop #endif //__BORLANDC__ -#ifndef WX_PRECOMP - #include - #include -#endif //WX_PRECOMP - #include #include #include @@ -227,16 +226,21 @@ wxConfigPathChanger::wxConfigPathChanger(const wxConfigBase *pContainer, const wxString& strEntry) { m_pContainer = (wxConfigBase *)pContainer; - wxString strPath = strEntry.Before(wxCONFIG_PATH_SEPARATOR); - // special case of "/keyname" when there is nothing before "/" - if ( strPath.IsEmpty() && ((!strEntry.IsEmpty()) && strEntry[0] == wxCONFIG_PATH_SEPARATOR )) + // the path is everything which precedes the last slash + wxString strPath = strEntry.BeforeLast(wxCONFIG_PATH_SEPARATOR); + + // except in the special case of "/keyname" when there is nothing before "/" + if ( strPath.IsEmpty() && + ((!strEntry.IsEmpty()) && strEntry[0] == wxCONFIG_PATH_SEPARATOR) ) + { strPath = wxCONFIG_PATH_SEPARATOR; + } if ( !strPath.IsEmpty() ) { // do change the path m_bChanged = TRUE; - m_strName = strEntry.Right(wxCONFIG_PATH_SEPARATOR); + m_strName = strEntry.AfterLast(wxCONFIG_PATH_SEPARATOR); m_strOldPath = m_pContainer->GetPath(); m_strOldPath += wxCONFIG_PATH_SEPARATOR; m_pContainer->SetPath(strPath); @@ -274,9 +278,9 @@ wxString wxExpandEnvVars(const wxString& str) { Bracket_None, Bracket_Normal = ')', - Bracket_Curly = '}', + Bracket_Curly = '}' #ifdef __WXMSW__ - Bracket_Windows = '%' // yeah, Windows people are a bit strange ;-) + ,Bracket_Windows = '%' // yeah, Windows people are a bit strange ;-) #endif }; @@ -412,5 +416,4 @@ void wxSplitPath(wxArrayString& aParts, const char *sz) #endif // wxUSE_CONFIG - - \ No newline at end of file +