X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/898efd1a880a264538d13266ea33e3205a4e032e..f7f1f70f4b123468e916b3f3cf4e0d35aa62da03:/src/common/config.cpp diff --git a/src/common/config.cpp b/src/common/config.cpp index d858319795..66e8d2017f 100644 --- a/src/common/config.cpp +++ b/src/common/config.cpp @@ -25,7 +25,7 @@ #include -#ifdef wxUSE_CONFIG +#if wxUSE_CONFIG #ifdef __BORLANDC__ #pragma hdrstop @@ -226,17 +226,20 @@ wxConfigPathChanger::wxConfigPathChanger(const wxConfigBase *pContainer, const wxString& strEntry) { m_pContainer = (wxConfigBase *)pContainer; -// wxString strPath = strEntry.Before(wxCONFIG_PATH_SEPARATOR); + + // the path is everything which precedes the last slash wxString strPath = strEntry.BeforeLast(wxCONFIG_PATH_SEPARATOR); - // special case of "/keyname" when there is nothing before "/" - if ( strPath.IsEmpty() && ((!strEntry.IsEmpty()) && strEntry[0] == 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;