aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2010-09-08 20:51:13 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2010-09-08 20:51:13 +0200
commita4bf1b0e656b84376ae8a3df93234653569a1a54 (patch)
tree6bc6b1ef27fd472025f501baea8ae4ac607e8da4
parentbf02d5e46fda0607313d3cc854741d9283ba7ce2 (diff)
Add extra level of argument quoting when on Windows
-rw-r--r--odb/odb.cxx19
1 files changed, 19 insertions, 0 deletions
diff --git a/odb/odb.cxx b/odb/odb.cxx
index d801e1f..488e4a3 100644
--- a/odb/odb.cxx
+++ b/odb/odb.cxx
@@ -304,6 +304,25 @@ main (int argc, char* argv[])
if (!v.empty ())
{
o += '=';
+
+ // On Windows we need to protect values with spaces using quotes.
+ // Since there could be actual quotes in the value, we need to
+ // escape them.
+ //
+#ifdef _WIN32
+ {
+ string t ("\"");
+ for (size_t i (0); i < v.size (); ++i)
+ {
+ if (v[i] == '"')
+ t += "\\\"";
+ else
+ t += v[i];
+ }
+ t += '"';
+ v = t;
+ }
+#endif
o += v;
}