19 object Isabelle_Env |
19 object Isabelle_Env |
20 { |
20 { |
21 /** bootstrap information **/ |
21 /** bootstrap information **/ |
22 |
22 |
23 def bootstrap_directory( |
23 def bootstrap_directory( |
24 preference: String, envar: String, property: String, description: String): String = |
24 preference: String, variable: String, property: String, description: String): String = |
25 { |
25 { |
26 val value = |
26 val a = preference // explicit argument |
27 proper_string(preference) orElse // explicit argument |
27 val b = System.getenv(variable) // e.g. inherited from running isabelle tool |
28 proper_string(System.getenv(envar)) orElse // e.g. inherited from running isabelle tool |
28 val c = System.getProperty(property) // e.g. via JVM application boot process |
29 proper_string(System.getProperty(property)) getOrElse // e.g. via JVM application boot process |
29 val dir = |
30 error("Unknown " + description + " directory") |
30 if (a != null && a.nonEmpty) a |
31 |
31 else if (b != null && b.nonEmpty) b |
32 if ((new JFile(value)).isDirectory) value |
32 else if (c != null && c.nonEmpty) c |
33 else error("Bad " + description + " directory " + quote(value)) |
33 else error("Unknown " + description + " directory") |
|
34 |
|
35 if ((new JFile(dir)).isDirectory) dir |
|
36 else error("Bad " + description + " directory " + quote(dir)) |
34 } |
37 } |
35 |
38 |
36 |
39 |
37 |
40 |
38 /** Support for Cygwin as POSIX emulation on Windows **/ |
41 /** Support for Cygwin as POSIX emulation on Windows **/ |