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

Alp Toker alp at nuanti.com
Thu Dec 4 14:44:33 PST 2014


On 04/12/2014 19:00, Matthias Braun wrote:
> Hi chandlerc,
>
> Most desktop environments let the users specify his preferred application per
> file type. On mac/linux we can use open/xdg-open for that and should try this
> first before starting a heuristic search for various programs.
>
> I hope this is not going to be too much of a bikesched discussion, but I really
> prefer it when I can configure the applications myself instead of having a
> hardcoded default list, though after seeing r210148 which tries 'gv' before
> 'xdg-open' I wonder if there is a problem with that approach for some people?
> Can you explain why you did this alp? Couldn't people just set their system to open all postscript files gv?

It's indeed a good idea to attempt 'xdg-open' before 'gv' on Unix/Linux. 
The only reason I didn't make it this way was in order to preserve 
identical functionality during the large refactoring from antiquated 
configure-time to runtime detection. In fact, having 'xdg-open' and 
'open' first has more or less always been the plan.

Note that the code is already there so I don't think you need to 
duplicate it as you suggested in your patch. See the existing code:

|  enum PSViewerKind { PSV_None, PSV_OSXOpen, PSV_XDGOpen, PSV_Ghostview 
};||
||  PSViewerKind PSViewer = PSV_None;||
||#ifdef __APPLE__||
||  if (!PSViewer && S.TryFindProgram("open", ViewerPath))||
||    PSViewer = PSV_OSXOpen;||
||#endif||
||  if (!PSViewer && S.TryFindProgram("gv", ViewerPath))||
||    PSViewer = PSV_Ghostview;||
||  if (!PSViewer && S.TryFindProgram("xdg-open", ViewerPath))||
||    PSViewer = PSV_XDGOpen;|

Simply shifting the order of "gv" and "xdg-open" should be sufficient, 
and can be achieved by reverting r210148. I'd be in favour of doing that 
now that the refactor is complete -- Matthias, can you see if simply 
reverting that small commit achieves what you want?

Alp.


>
> http://reviews.llvm.org/D6534
>
> Files:
>    lib/Support/GraphWriter.cpp
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

-- 
http://www.nuanti.com
the browser experts

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141204/0fa2beb2/attachment.html>


More information about the llvm-commits mailing list