From: Vadim Zeitlin Date: Sun, 7 Jan 2007 22:41:39 +0000 (+0000) Subject: fix wxConfig::DeleteGroup() for arguments with trailing slash (replaces patch 1624589) X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/f559e6218d849dddd07d6c2adffa115e55b70576 fix wxConfig::DeleteGroup() for arguments with trailing slash (replaces patch 1624589) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44148 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/common/config.cpp b/src/common/config.cpp index 1f2134beec..16cc86d8f2 100644 --- a/src/common/config.cpp +++ b/src/common/config.cpp @@ -297,6 +297,24 @@ wxConfigPathChanger::~wxConfigPathChanger() } } +// this is a wxConfig method but it's mainly used with wxConfigPathChanger +/* static */ +wxString wxConfigBase::RemoveTrailingSeparator(const wxString& key) +{ + wxString path(key); + + // don't remove the only separator from a root group path! + while ( path.length() > 1 ) + { + if ( *path.rbegin() != wxCONFIG_PATH_SEPARATOR ) + break; + + path.erase(path.end() - 1); + } + + return path; +} + #endif // wxUSE_CONFIG // ----------------------------------------------------------------------------