src/Pure/library.ML
changeset 43603 8f777c2e4638
parent 43559 c1966f322105
child 43652 dcd0b667f73d
--- a/src/Pure/library.ML	Thu Jun 30 13:21:41 2011 +0200
+++ b/src/Pure/library.ML	Thu Jun 30 13:59:55 2011 +0200
@@ -218,6 +218,10 @@
   val serial: unit -> serial
   val serial_string: unit -> string
   structure Object: sig type T = exn end
+  val cd: string -> unit
+  val pwd: unit -> string
+  val getenv: string -> string
+  val getenv_strict: string -> string
 end;
 
 signature LIBRARY =
@@ -1079,6 +1083,25 @@
   constructors at any time*)
 structure Object = struct type T = exn end;
 
+
+(* current directory *)
+
+val cd = OS.FileSys.chDir;
+val pwd = OS.FileSys.getDir;
+
+
+(* getenv *)
+
+fun getenv x =
+  (case OS.Process.getEnv x of
+    NONE => ""
+  | SOME y => y);
+
+fun getenv_strict x =
+  (case getenv x of
+    "" => error ("Undefined Isabelle environment variable: " ^ quote x)
+  | y => y);
+
 end;
 
 structure Basic_Library: BASIC_LIBRARY = Library;