We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 83437d8 commit 143f2c1Copy full SHA for 143f2c1
config.cpp
@@ -95,8 +95,18 @@ std::string Config::command() const
95
96
cmd += "\"" + m_cppcheck + "\"";
97
98
- for (const auto &arg : m_args)
99
- cmd += " \"" + arg + "\"";
+ for (const auto &arg : m_args) {
+ // If arg contains double quotes, escape them
100
+ std::string escapedArg = arg;
101
+ size_t pos = 0;
102
+ while ((pos = escapedArg.find("\"", pos)) != std::string::npos) {
103
+ escapedArg.replace(pos, 1, "\\\"");
104
+ pos += 2;
105
+ }
106
+ cmd += " \"" + escapedArg + "\"";
107
+
108
109
110
111
if (!m_projectFilePath.empty()) {
112
cmd += " \"--project=" + m_projectFilePath.string() + "\" \"--file-filter=" + m_filename.string() + "\"";
0 commit comments