Fix backslashes in graphviz causing incorrect rendering on windows.
authorSpencer Judge <sjudge@tableausoftware.com>
Tue, 7 Apr 2015 21:18:43 +0000 (14:18 -0700)
committerSpencer Judge <sjudge@tableausoftware.com>
Wed, 8 Apr 2015 16:28:28 +0000 (09:28 -0700)
src/graphviz.cc

index 8354a22..dce8b32 100644 (file)
@@ -15,6 +15,7 @@
 #include "graphviz.h"
 
 #include <stdio.h>
+#include <algorithm>
 
 #include "graph.h"
 
@@ -22,7 +23,9 @@ void GraphViz::AddTarget(Node* node) {
   if (visited_nodes_.find(node) != visited_nodes_.end())
     return;
 
-  printf("\"%p\" [label=\"%s\"]\n", node, node->path().c_str());
+  string pathstr = node->path();
+  replace(pathstr.begin(), pathstr.end(), '\\', '/');
+  printf("\"%p\" [label=\"%s\"]\n", node, pathstr.c_str());
   visited_nodes_.insert(node);
 
   Edge* edge = node->in_edge();