]> git.saurik.com Git - wxWidgets.git/commitdiff
fix wxConfig::DeleteGroup() for arguments with trailing slash (replaces patch 1624589)
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 7 Jan 2007 22:41:39 +0000 (22:41 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 7 Jan 2007 22:41:39 +0000 (22:41 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44148 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/config.cpp

index 1f2134beecc5ec4f35c47c02c122d5dbb015150d..16cc86d8f28c5b728d6b6c0fda5643f0a0f03332 100644 (file)
@@ -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
 
 // ----------------------------------------------------------------------------