'\\' can be used to suppress special meaning in '%' and '$' in wxExpandEnvVars
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@505 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
d1427b7053
commit
906373bf01
@ -222,11 +222,12 @@ wxString wxExpandEnvVars(const wxString& str)
|
||||
// check the closing bracket
|
||||
if ( bracket != Bracket_None ) {
|
||||
if ( m == str.Len() || str[m] != (char)bracket ) {
|
||||
wxLogWarning(_("missing '%c' at position %d in '%s'."),
|
||||
wxLogWarning(_("Environment variables expansion failed: "
|
||||
"missing '%c' at position %d in '%s'."),
|
||||
(char)bracket, m + 1, str.c_str());
|
||||
}
|
||||
else {
|
||||
// skip closing bracket
|
||||
// skip closing bracket unless the variables wasn't expanded
|
||||
if ( pszValue == NULL )
|
||||
strResult << (char)bracket;
|
||||
m++;
|
||||
@ -237,6 +238,15 @@ wxString wxExpandEnvVars(const wxString& str)
|
||||
}
|
||||
break;
|
||||
|
||||
case '\\':
|
||||
// backslash can be used to suppress special meaning of % and $
|
||||
if ( n != str.Len() && (str[n + 1] == '%' || str[n + 1] == '$') ) {
|
||||
strResult += str[++n];
|
||||
|
||||
break;
|
||||
}
|
||||
//else: fall through
|
||||
|
||||
default:
|
||||
strResult += str[n];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user