From: Vadim Zeitlin Date: Wed, 20 Jan 1999 14:47:59 +0000 (+0000) Subject: wxString::Right() changed to AfterLast() (config works again) X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/08159082b5d9335f9709c0cc06a9ff0aaf15e274?ds=sidebyside wxString::Right() changed to AfterLast() (config works again) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1434 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/common/config.cpp b/src/common/config.cpp index d858319795..9551a9b94c 100644 --- a/src/common/config.cpp +++ b/src/common/config.cpp @@ -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; diff --git a/src/msw/regconf.cpp b/src/msw/regconf.cpp index f06413bf31..99382c2ce2 100644 --- a/src/msw/regconf.cpp +++ b/src/msw/regconf.cpp @@ -448,7 +448,7 @@ bool wxRegConfig::DeleteEntry(const wxString& value, bool bGroupIfEmptyAlso) return FALSE; if ( !m_keyLocal.HasSubkeys() ) { - wxString strKey = GetPath().Right(wxCONFIG_PATH_SEPARATOR); + wxString strKey = GetPath().AfterLast(wxCONFIG_PATH_SEPARATOR); SetPath(".."); // changes m_keyLocal return m_keyLocal.DeleteKey(strKey); }