]> git.saurik.com Git - wxWidgets.git/commitdiff
mention compatibility implications of wxExecute() quoting changes; don't change quoti...
authorVadim Zeitlin <vadim@wxwidgets.org>
Fri, 18 Jul 2008 22:22:16 +0000 (22:22 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Fri, 18 Jul 2008 22:22:16 +0000 (22:22 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54695 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/changes.txt
src/msw/utilsexc.cpp

index 90ff54651148d1b764774b93dfa2f38e256de541..572750c2d8e71824dccd132a9ddf7bf786ac5074 100644 (file)
@@ -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";
index 7c085553ed2893396b5eb1fd6d1375e02593b8da..f67e0eb11d9cf3024b5b7e6f2c9f2f5c1b200dd1 100644 (file)
@@ -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;