src/Pure/library.ML
changeset 43603 8f777c2e4638
parent 43559 c1966f322105
child 43652 dcd0b667f73d
     1.1 --- a/src/Pure/library.ML	Thu Jun 30 13:21:41 2011 +0200
     1.2 +++ b/src/Pure/library.ML	Thu Jun 30 13:59:55 2011 +0200
     1.3 @@ -218,6 +218,10 @@
     1.4    val serial: unit -> serial
     1.5    val serial_string: unit -> string
     1.6    structure Object: sig type T = exn end
     1.7 +  val cd: string -> unit
     1.8 +  val pwd: unit -> string
     1.9 +  val getenv: string -> string
    1.10 +  val getenv_strict: string -> string
    1.11  end;
    1.12  
    1.13  signature LIBRARY =
    1.14 @@ -1079,6 +1083,25 @@
    1.15    constructors at any time*)
    1.16  structure Object = struct type T = exn end;
    1.17  
    1.18 +
    1.19 +(* current directory *)
    1.20 +
    1.21 +val cd = OS.FileSys.chDir;
    1.22 +val pwd = OS.FileSys.getDir;
    1.23 +
    1.24 +
    1.25 +(* getenv *)
    1.26 +
    1.27 +fun getenv x =
    1.28 +  (case OS.Process.getEnv x of
    1.29 +    NONE => ""
    1.30 +  | SOME y => y);
    1.31 +
    1.32 +fun getenv_strict x =
    1.33 +  (case getenv x of
    1.34 +    "" => error ("Undefined Isabelle environment variable: " ^ quote x)
    1.35 +  | y => y);
    1.36 +
    1.37  end;
    1.38  
    1.39  structure Basic_Library: BASIC_LIBRARY = Library;