aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/options.ml
diff options
context:
space:
mode:
Diffstat (limited to 'lib/options.ml')
-rw-r--r--lib/options.ml21
1 files changed, 17 insertions, 4 deletions
diff --git a/lib/options.ml b/lib/options.ml
index 45f27107e..17e8af182 100644
--- a/lib/options.ml
+++ b/lib/options.ml
@@ -120,7 +120,20 @@ let boxed_definitions _ = !boxed_definitions
(* Options for external tools *)
let browser_cmd_fmt =
- if Sys.os_type = "Win32"
- then "C:\\PROGRA~1\\INTERN~1\\IEXPLORE ", ""
- else "netscape -remote \"OpenURL(", ")\""
-
+ try
+ let coq_netscape_remote_var = "COQREMOTEBROWSER" in
+ let coq_netscape_remote = Sys.getenv coq_netscape_remote_var in
+ let i = Util.string_index_from coq_netscape_remote 0 "%s" in
+ let pre = String.sub coq_netscape_remote 0 i in
+ let post = String.sub coq_netscape_remote (i + 2)
+ (String.length coq_netscape_remote - (i + 2)) in
+ if Util.string_string_contains ~where:post ~what:"%s" then
+ error ("The environment variable \"" ^
+ coq_netscape_remote_var ^
+ "\" must contain exactly one placeholder \"%s\".")
+ else pre,post
+ with
+ Not_found ->
+ if Sys.os_type = "Win32"
+ then "C:\\PROGRA~1\\INTERN~1\\IEXPLORE ", ""
+ else "netscape -remote \"OpenURL(", ")\""