From a4bf1b0e656b84376ae8a3df93234653569a1a54 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 8 Sep 2010 20:51:13 +0200 Subject: Add extra level of argument quoting when on Windows --- odb/odb.cxx | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) 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; } -- cgit v1.1