Skip to content
Snippets Groups Projects
Commit e85a88d5 authored by erwan's avatar erwan
Browse files

fix: try harder to find a working pdf reader

parent fb6fdca8
No related branches found
No related tags found
No related merge requests found
......@@ -239,7 +239,7 @@ let _ =
(* split the vars into returns (the enab vars, the activated vars,
the other vars) nb: in the "Enab" prefix is removed from enab vars
names; ie we leave only the pid and the action name *)
type s = (string * string * Data.v)
type s = (string string * Data.v)
let split_data (l:Data.subst list) : s list * s list * s list =
let l = List.map (fun (x,v) -> Str.split (Str.regexp "_") x, v) l in
let rec sortv (enab, other) (x,v) =
......@@ -438,14 +438,20 @@ let l () =
(**********************************************************************)
(* ok, let's start the debugging session! *)
let pdf_viewer =
if Sys.command "which zathura" = 0 then "zathura" else
let pdf_viewer = (* try hard to find a working pdf viewer! *)
try
let res = Unix.getenv "PDF_VIEWER" in (* may raise Not_found *)
if Sys.command (Printf.sprintf "which %s" res) = 0 then res else raise Not_found
with Not_found ->
if Sys.command "which see" = 0 then "see" else
if Sys.command "which zathura" = 0 then "zathura" else
if Sys.command "which okular" = 0 then "okular" else
if Sys.command "which xpdf" = 0 then "xpdf" else
if Sys.command "which acroread" = 0 then "acroread" else
if Sys.command "which evince" = 0 then "evince" else (
Printf.printf "Warning: no pdf viewer is found to visualize %s\n%!" dotfile;
"ls"
)
if Sys.command "which evince" = 0 then "evince" else
if Sys.command "which acroread" = 0 then "acroread" else (
Printf.printf "Warning: no pdf viewer found to visualize %s\n%!" dotfile;
"ls"
)
let graph_view () =
!dot_view ();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment