mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-03-05 12:31:46 +00:00
GraphWriter: support the XDG open utility
This runs a suitable viewer on Unix desktop environments specified by Freedesktop.org (GNOME, KDE, Linux distributions etc.) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210147 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
4830b9c727
commit
a5bd2adbc7
@ -164,12 +164,14 @@ bool llvm::DisplayGraph(StringRef FilenameRef, bool wait,
|
|||||||
return ExecGraphViewer(ViewerPath, args, Filename, wait, ErrMsg);
|
return ExecGraphViewer(ViewerPath, args, Filename, wait, ErrMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
enum PSViewerKind { PSV_None, PSV_OSXOpen, PSV_Ghostview };
|
enum PSViewerKind { PSV_None, PSV_OSXOpen, PSV_XDGOpen, PSV_Ghostview };
|
||||||
PSViewerKind PSViewer = PSV_None;
|
PSViewerKind PSViewer = PSV_None;
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
if (S.TryFindProgram("open", ViewerPath))
|
if (!PSViewer && S.TryFindProgram("open", ViewerPath))
|
||||||
PSViewer = PSV_OSXOpen;
|
PSViewer = PSV_OSXOpen;
|
||||||
#endif
|
#endif
|
||||||
|
if (!PSViewer && S.TryFindProgram("xdg-open", ViewerPath))
|
||||||
|
PSViewer = PSV_XDGOpen;
|
||||||
if (!PSViewer && S.TryFindProgram("gv", ViewerPath))
|
if (!PSViewer && S.TryFindProgram("gv", ViewerPath))
|
||||||
PSViewer = PSV_Ghostview;
|
PSViewer = PSV_Ghostview;
|
||||||
|
|
||||||
@ -202,6 +204,10 @@ bool llvm::DisplayGraph(StringRef FilenameRef, bool wait,
|
|||||||
args.push_back("-W");
|
args.push_back("-W");
|
||||||
args.push_back(PSFilename.c_str());
|
args.push_back(PSFilename.c_str());
|
||||||
break;
|
break;
|
||||||
|
case PSV_XDGOpen:
|
||||||
|
wait = false;
|
||||||
|
args.push_back(PSFilename.c_str());
|
||||||
|
break;
|
||||||
case PSV_Ghostview:
|
case PSV_Ghostview:
|
||||||
args.push_back("--spartan");
|
args.push_back("--spartan");
|
||||||
args.push_back(PSFilename.c_str());
|
args.push_back(PSFilename.c_str());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user