From f559e6218d849dddd07d6c2adffa115e55b70576 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 7 Jan 2007 22:41:39 +0000 Subject: [PATCH] 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 --- src/common/config.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/common/config.cpp b/src/common/config.cpp index 1f2134b..16cc86d 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 // ---------------------------------------------------------------------------- -- 2.7.4