aboutsummaryrefslogtreecommitdiffhomepage
path: root/ide/minilib.ml
diff options
context:
space:
mode:
authorGravatar letouzey <letouzey@85f007b7-540e-0410-9357-904b9bb8a0f7>2012-05-16 12:49:17 +0000
committerGravatar letouzey <letouzey@85f007b7-540e-0410-9357-904b9bb8a0f7>2012-05-16 12:49:17 +0000
commit2e30c99c1b3bd7e39229efe041ca4677e27fd673 (patch)
treea26c9660607b28fe6d8b9ea3686f269e8b49e797 /ide/minilib.ml
parentc5e6d03b4dc5a5f4dc2037fa19cb5f319aafb188 (diff)
Revert commit 15287 : the env variables are indeed access at launch-time
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@15331 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'ide/minilib.ml')
-rw-r--r--ide/minilib.ml53
1 files changed, 16 insertions, 37 deletions
diff --git a/ide/minilib.ml b/ide/minilib.ml
index eba5499e9..2400872a4 100644
--- a/ide/minilib.ml
+++ b/ide/minilib.ml
@@ -71,54 +71,33 @@ let path_to_list p =
(* On win32, the home directory is probably not in $HOME, but in
some other environment variable *)
-let home () =
+let home =
try Sys.getenv "HOME" with Not_found ->
try (Sys.getenv "HOMEDRIVE")^(Sys.getenv "HOMEPATH") with Not_found ->
try Sys.getenv "USERPROFILE" with Not_found -> Filename.current_dir_name
-let xdg_config_home () =
+let xdg_config_home =
try
Filename.concat (Sys.getenv "XDG_CONFIG_HOME") "coq"
with Not_found ->
- let home_dir = home () in
- Filename.concat home_dir "/.config/coq"
-
-let xdg_config_dirs () =
- let config_home = xdg_config_home () in
- let config_list =
- try path_to_list (Sys.getenv "XDG_CONFIG_DIRS")
- with Not_found -> ["/etc/xdg"]
- in
- let remaining =
- List.map (fun dir -> Filename.concat dir "coq") config_list
- in
- let def = match Coq_config.configdir with
- | None -> []
- | Some d -> [d]
- in
- config_home :: remaining @ def
+ Filename.concat home "/.config/coq"
-let xdg_data_home () =
+let xdg_config_dirs =
+ xdg_config_home :: (try
+ List.map (fun dir -> Filename.concat dir "coq") (path_to_list (Sys.getenv "XDG_CONFIG_DIRS"))
+ with Not_found -> ["/etc/xdg/coq"])@(match Coq_config.configdir with |None -> [] |Some d -> [d])
+
+let xdg_data_home =
try
Filename.concat (Sys.getenv "XDG_DATA_HOME") "coq"
with Not_found ->
- let home_dir = home () in
- Filename.concat home_dir "/.local/share/coq"
-
-let xdg_data_dirs () =
- let data_home = xdg_data_home () in
- let data_list =
- try path_to_list (Sys.getenv "XDG_DATA_DIRS")
- with Not_found -> ["/usr/local/share";"/usr/share"]
- in
- let remaining =
- List.map (fun dir -> Filename.concat dir "coq") data_list
- in
- let def = match Coq_config.datadir with
- | None -> []
- | Some d -> [d]
- in
- data_home :: remaining @ def
+ Filename.concat home "/.local/share/coq"
+
+let xdg_data_dirs =
+ xdg_data_home :: (try
+ List.map (fun dir -> Filename.concat dir "coq") (path_to_list (Sys.getenv "XDG_DATA_DIRS"))
+ with Not_found ->
+ ["/usr/local/share/coq";"/usr/share/coq"])@(match Coq_config.datadir with |None -> [] |Some d -> [d])
let coqtop_path = ref ""