X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/42841dfcaddc6045ffc618acbb620b1fde1bc618..7596e51dbc3b7d65411fbe708c8aafb13ee26701:/src/common/config.cpp?ds=inline diff --git a/src/common/config.cpp b/src/common/config.cpp index 00f2daa6b7..30ca1fa2e7 100644 --- a/src/common/config.cpp +++ b/src/common/config.cpp @@ -73,6 +73,11 @@ wxConfigBase::wxConfigBase(const wxString& appName, m_bRecordDefaults = false; } +wxConfigBase::~wxConfigBase() +{ + // required here for Darwin +} + wxConfigBase *wxConfigBase::Set(wxConfigBase *pConfig) { wxConfigBase *pOld = ms_pConfig; @@ -235,15 +240,20 @@ wxConfigPathChanger::wxConfigPathChanger(const wxConfigBase *pContainer, strPath = wxCONFIG_PATH_SEPARATOR; } - if ( !strPath.IsEmpty() && m_pContainer->GetPath() != strPath ) { - // do change the path - m_bChanged = true; + if ( !strPath.IsEmpty() ) + { + if ( m_pContainer->GetPath() != strPath ) + { + // do change the path + m_bChanged = true; + m_strOldPath = m_pContainer->GetPath(); + if ( *m_strOldPath.c_str() != wxCONFIG_PATH_SEPARATOR ) + m_strOldPath += wxCONFIG_PATH_SEPARATOR; + m_pContainer->SetPath(strPath); + } + + // in any case, use the just the name, not full path m_strName = strEntry.AfterLast(wxCONFIG_PATH_SEPARATOR); - m_strOldPath = m_pContainer->GetPath(); - if ( m_strOldPath.Len() == 0 || - m_strOldPath.Last() != wxCONFIG_PATH_SEPARATOR ) - m_strOldPath += wxCONFIG_PATH_SEPARATOR; - m_pContainer->SetPath(strPath); } else { // it's a name only, without path - nothing to do @@ -374,7 +384,8 @@ wxString wxExpandEnvVars(const wxString& str) case '\\': // backslash can be used to suppress special meaning of % and $ - if ( n != str.Len() && (str[n + 1] == wxT('%') || str[n + 1] == wxT('$')) ) { + if ( n != str.Len() - 1 && + (str[n + 1] == wxT('%') || str[n + 1] == wxT('$')) ) { strResult += str[++n]; break;