diff --git a/src/common/cmdline.cpp b/src/common/cmdline.cpp index 95afbfe27f..ce169ac95b 100644 --- a/src/common/cmdline.cpp +++ b/src/common/cmdline.cpp @@ -1332,7 +1332,7 @@ wxCmdLineParser::ConvertStringToArgs(const wxString& cmdline, break; } - lastBS = ch == '\\'; + lastBS = !lastBS && ch == '\\'; } else // type == wxCMD_LINE_SPLIT_UNIX { diff --git a/tests/cmdline/cmdlinetest.cpp b/tests/cmdline/cmdlinetest.cpp index e27bcccbba..04e5c2ac83 100644 --- a/tests/cmdline/cmdlinetest.cpp +++ b/tests/cmdline/cmdlinetest.cpp @@ -96,6 +96,7 @@ void CmdLineTestCase::ConvertStringTestCase() WX_ASSERT_ARGS_EQUAL( "1|2 3|4", "1 \"2 3\" 4" ); // check for (broken) Windows semantics: backslash doesn't escape spaces + WX_ASSERT_DOS_ARGS_EQUAL( "\\\\foo\\\\|/bar", "\"\\\\foo\\\\\" /bar" ); WX_ASSERT_DOS_ARGS_EQUAL( "foo|bar\\|baz", "foo bar\\ baz" ); WX_ASSERT_DOS_ARGS_EQUAL( "foo|bar\\\"baz", "foo \"bar\\\"baz\"" );