X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/bf7f7793e9c6e2fc3fcb8297ab7b3b56e3e9eea2..c6a6bbbf637a5a580b7ab182483d27522f5e3189:/src/common/config.cpp diff --git a/src/common/config.cpp b/src/common/config.cpp index 1f2134beec..660932e469 100644 --- a/src/common/config.cpp +++ b/src/common/config.cpp @@ -57,6 +57,7 @@ bool wxConfigBase::ms_bAutoCreate = true; // ---------------------------------------------------------------------------- // wxConfigBase // ---------------------------------------------------------------------------- +IMPLEMENT_ABSTRACT_CLASS(wxConfigBase, wxObject) // Not all args will always be used by derived classes, but including them all // in each class ensures compatibility. @@ -297,6 +298,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 // ---------------------------------------------------------------------------- @@ -327,7 +346,7 @@ wxString wxExpandEnvVars(const wxString& str) size_t m; for ( size_t n = 0; n < str.length(); n++ ) { - switch ( str[n] ) { + switch ( str[n].GetValue() ) { #ifdef __WXMSW__ case wxT('%'): #endif //WINDOWS @@ -343,7 +362,7 @@ wxString wxExpandEnvVars(const wxString& str) bracket = Bracket_None; } else { - switch ( str[n + 1] ) { + switch ( str[n + 1].GetValue() ) { case wxT('('): bracket = Bracket_Normal; n++; // skip the bracket @@ -406,7 +425,7 @@ wxString wxExpandEnvVars(const wxString& str) else { // skip closing bracket unless the variables wasn't expanded if ( pszValue == NULL ) - strResult << (char)bracket; + strResult << (wxChar)bracket; m++; } } @@ -415,7 +434,7 @@ wxString wxExpandEnvVars(const wxString& str) } break; - case '\\': + case wxT('\\'): // backslash can be used to suppress special meaning of % and $ if ( n != str.length() - 1 && (str[n + 1] == wxT('%') || str[n + 1] == wxT('$')) ) {