[PATCH] [GraphWriter] Attempt to open .dot files with xdg-open/open first

Phabricator reviews at reviews.llvm.org
Fri Apr 3 10:25:32 PDT 2015


REPOSITORY
  rL LLVM

http://reviews.llvm.org/D6534

Files:
  llvm/trunk/lib/Support/GraphWriter.cpp

Index: llvm/trunk/lib/Support/GraphWriter.cpp
===================================================================
--- llvm/trunk/lib/Support/GraphWriter.cpp
+++ llvm/trunk/lib/Support/GraphWriter.cpp
@@ -140,6 +140,29 @@
   std::string ViewerPath;
   GraphSession S;
 
+#ifdef __APPLE__
+  if (S.TryFindProgram("open", ViewerPath)) {
+    std::vector<const char *> args;
+    args.push_back(ViewerPath.c_str());
+    if (wait)
+      args.push_back("-W");
+    args.push_back(Filename.c_str());
+    args.push_back(nullptr);
+    errs() << "Trying 'open' program... ";
+    if (!ExecGraphViewer(ViewerPath, args, Filename, wait, ErrMsg))
+      return false;
+  }
+#endif
+  if (S.TryFindProgram("xdg-open", ViewerPath)) {
+    std::vector<const char *> args;
+    args.push_back(ViewerPath.c_str());
+    args.push_back(Filename.c_str());
+    args.push_back(nullptr);
+    errs() << "Trying 'xdg-open' program... ";
+    if (!ExecGraphViewer(ViewerPath, args, Filename, wait, ErrMsg))
+      return false;
+  }
+
   // Graphviz
   if (S.TryFindProgram("Graphviz", ViewerPath)) {
     std::vector<const char *> args;

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D6534.23225.patch
Type: text/x-patch
Size: 1118 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150403/262ac67b/attachment.bin>


More information about the llvm-commits mailing list