X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/bf7f7793e9c6e2fc3fcb8297ab7b3b56e3e9eea2..655c20fcd5a554a986b93651d8b0bec2afde8573:/src/common/config.cpp?ds=sidebyside 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 // ----------------------------------------------------------------------------