mention compatibility implications of wxExecute() quoting changes; don't change quoting of already quoted arguments in 2.8 for compatibility; also fix handling of empty arguments as a side effect (see #4115)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54695 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
8a9e5d8590
commit
a6eac99d9e
@ -99,6 +99,8 @@ Changes in behaviour not resulting in compilation errors, please read this!
|
||||
your code if you overrode these functions and change the functions in the
|
||||
derived classes to use const reference as well.
|
||||
|
||||
- Under MSW wxExecute() arguments are now always properly quoted, as under
|
||||
Unix, and so shouldn't contain quotes unless they are part of the argument.
|
||||
|
||||
Changes in behaviour which may result in compilation errors
|
||||
-----------------------------------------------------------
|
||||
@ -132,7 +134,7 @@ Changes in behaviour which may result in compilation errors
|
||||
const wxChar*. wxCStrData is implicitly convertible to both "const char *"
|
||||
and "const wchar_t *", so this only presents a problem if the compiler cannot
|
||||
apply the conversion. This can happen in 2 cases:
|
||||
|
||||
|
||||
+ There is an ambiguity because the function being called is overloaded to
|
||||
take both "const char *" and "const wchar_t *" as the compiler can't choose
|
||||
between them. In this case you may use s.wx_str() to call the function
|
||||
@ -208,7 +210,7 @@ Deprecated methods and their replacements
|
||||
use simpler OnExec() version which is called with wxString argument
|
||||
- wxMenuItem::GetLabel has been deprecated in favour of wxMenuItem::GetItemLabelText
|
||||
- wxMenuItem::GetText has been deprecated in favour of wxMenuItem::GetItemLabel
|
||||
- wxMenuItem::GetLabelFromText has been deprecated in favour of wxMenuItem::GetLabelText
|
||||
- wxMenuItem::GetLabelFromText has been deprecated in favour of wxMenuItem::GetLabelText
|
||||
- wxMenuItem::SetText has been deprecated in favour of wxMenuItem::SetItemLabel
|
||||
- wxBrush's, wxPen's SetStyle() and GetStyle() as well as the wxBrush/wxPen ctor now take
|
||||
respectively a wxBrushStyle and a wxPenStyle value instead of a plain "int style";
|
||||
|
@ -1032,16 +1032,28 @@ long wxExecuteImpl(CharType **argv, int flags, wxProcess *handler)
|
||||
{
|
||||
arg = *argv++;
|
||||
|
||||
// escape any quotes present in the string to avoid interfering with
|
||||
// the command line parsing in the child process
|
||||
arg.Replace("\"", "\\\"", true /* replace all */);
|
||||
bool quote;
|
||||
if ( arg.empty() )
|
||||
{
|
||||
// we need to quote empty arguments, otherwise they'd just
|
||||
// disappear
|
||||
quote = true;
|
||||
}
|
||||
else // non-empty
|
||||
{
|
||||
// escape any quotes present in the string to avoid interfering
|
||||
// with the command line parsing in the child process
|
||||
arg.Replace("\"", "\\\"", true /* replace all */);
|
||||
|
||||
// and quote any arguments containing the spaces to prevent them from
|
||||
// being broken down
|
||||
if ( arg.find_first_of(" \t") == wxString::npos )
|
||||
command += arg;
|
||||
else
|
||||
// and quote any arguments containing the spaces to prevent them from
|
||||
// being broken down
|
||||
quote = arg.find_first_of(" \t") != wxString::npos;
|
||||
}
|
||||
|
||||
if ( quote )
|
||||
command += '\"' + arg + '\"';
|
||||
else
|
||||
command += arg;
|
||||
|
||||
if ( !*argv )
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user