aboutsummaryrefslogtreecommitdiff
path: root/lib/system.ml
diff options
context:
space:
mode:
authorletouzey2011-04-21 16:12:34 +0000
committerletouzey2011-04-21 16:12:34 +0000
commit9ccd1899dba51e24216d0de8865eecf029f44cef (patch)
tree0b25a558459b4d8f789e87162646587488f31ae9 /lib/system.ml
parent08642139dc3edf2caf94e7f246c15644daca16ad (diff)
Win32: remove the need for Coq.bat and Coqide.bat
This is an adaptation of commit r13750 of branch 8.3 - coqlib is currently computed relatively of Sys.executable_name, hence no need to set it manually - in Win32, better detection of user home dir : in System.ml, if HOME isn't set, we look now for HOMEDRIVE\HOMEPATH, and then for USERPROFILE - concerning PATH, in Win32 we now add coqbin (or the location of coqide) to PATH during the initialization. git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@14041 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'lib/system.ml')
-rw-r--r--lib/system.ml13
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/system.ml b/lib/system.ml
index 23c6081bbd..f5c96256ff 100644
--- a/lib/system.ml
+++ b/lib/system.ml
@@ -19,12 +19,21 @@ let safe_getenv_def var def =
Sys.getenv var
with Not_found ->
warning ("Environment variable "^var^" not found: using '"^def^"' .");
- flush Pervasives.stdout;
+ flush_all ();
def
let getenv_else s dft = try Sys.getenv s with Not_found -> dft
-let home = (safe_getenv_def "HOME" ".")
+(* On win32, the home directory is probably not in $HOME, but in
+ some other environment variable *)
+
+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 ->
+ warning ("Cannot determine user home directory, using '.' .");
+ flush_all ();
+ "."
let safe_getenv n = safe_getenv_def n ("$"^n)