aboutsummaryrefslogtreecommitdiff
path: root/toplevel
diff options
context:
space:
mode:
authorfilliatr1999-12-06 16:13:39 +0000
committerfilliatr1999-12-06 16:13:39 +0000
commitd85853cc413417674f304db3ae0c42621ede1f94 (patch)
treef908baca72a8e83eea5f2d17f8ed117786b11e94 /toplevel
parentc7b600aa934cc245f7b8a58187833b6b45a2bee4 (diff)
initialisation load path (provisoire)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@214 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'toplevel')
-rw-r--r--toplevel/coqinit.ml30
1 files changed, 13 insertions, 17 deletions
diff --git a/toplevel/coqinit.ml b/toplevel/coqinit.ml
index c644989040..5d968321a7 100644
--- a/toplevel/coqinit.ml
+++ b/toplevel/coqinit.ml
@@ -52,26 +52,22 @@ let hm2 s =
let n = String.length s in
if n > 1 && s.[0] = '.' && s.[1] = '/' then String.sub s 2 (n-2) else s
+let getenv_else s dft = try Sys.getenv s with Not_found -> dft
+
(* Initializes the LoadPath according to COQLIB and Coq_config *)
let init_load_path () =
(* default load path; only if COQLIB is defined *)
- begin
- try
- let coqlib = Sys.getenv "COQLIB" in
- if coqlib <> "" then
- List.iter
- (fun s -> add_include (Filename.concat coqlib s))
- ("states" ::
- (List.map (fun s -> Filename.concat "theories" (hm2 s))
- Coq_config.theories_dirs))
- with Not_found -> ()
- end ;
- begin
- try
- let camlp4 = Sys.getenv "CAMLP4LIB" in add_include camlp4
- with Not_found -> ()
- end ;
- add_include "." ;
+ let coqlib = getenv_else "COQLIB" Coq_config.coqlib in
+ if coqlib <> "" then
+ List.iter
+ (fun s -> add_include (Filename.concat coqlib s))
+ ("states" ::
+ (List.map
+ (fun s -> Filename.concat "theories" (hm2 s))
+ Coq_config.theories_dirs));
+ let camlp4 = getenv_else "CAMLP4LIB" Coq_config.camlp4lib in
+ add_include camlp4;
+ add_include ".";
(* additional loadpath, given with -I -include -R options *)
List.iter add_include (List.rev !includes);
includes := []