When expanding $in and $out, wrap with quotes if the filename has a space.
authorJeremy Apthorp <jeremya@chromium.org>
Mon, 28 Nov 2011 02:54:35 +0000 (13:54 +1100)
committerJeremy Apthorp <jeremya@chromium.org>
Mon, 2 Jan 2012 23:35:30 +0000 (10:35 +1100)
src/graph.cc

index 9f7fc76..ed7097b 100644 (file)
@@ -189,7 +189,14 @@ string EdgeEnv::MakePathList(vector<Node*>::iterator begin,
   for (vector<Node*>::iterator i = begin; i != end; ++i) {
     if (!result.empty())
       result.push_back(' ');
-    result.append((*i)->path());
+    const string& path = (*i)->path();
+    if (path.find(" ") != string::npos) {
+      result.append("\"");
+      result.append(path);
+      result.append("\"");
+    } else {
+      result.append(path);
+    }
   }
   return result;
 }