Isabelle_System.mkdirs with explicit error checking (in accordance to ML version), e.g. relevant with read-only DMG file-system on Mac OS X;
authorwenzelm
Mon, 14 Jan 2013 22:24:57 +0100
changeset 50893 d55eb82ae77b
parent 50892 9a7d81d66d09
child 50894 a9c1b1428e87
Isabelle_System.mkdirs with explicit error checking (in accordance to ML version), e.g. relevant with read-only DMG file-system on Mac OS X;
src/Pure/System/isabelle_system.scala
src/Pure/System/options.scala
src/Pure/Tools/build.scala
--- a/src/Pure/System/isabelle_system.scala	Mon Jan 14 21:37:42 2013 +0100
+++ b/src/Pure/System/isabelle_system.scala	Mon Jan 14 22:24:57 2013 +0100
@@ -210,6 +210,15 @@
   }
 
 
+  /* mkdirs */
+
+  def mkdirs(path: Path)
+  {
+    path.file.mkdirs
+    if (!path.is_dir) error("Cannot create directory: " + quote(platform_path(path)))
+  }
+
+
 
   /** external processes **/
 
--- a/src/Pure/System/options.scala	Mon Jan 14 21:37:42 2013 +0100
+++ b/src/Pure/System/options.scala	Mon Jan 14 22:24:57 2013 +0100
@@ -348,7 +348,7 @@
       changed.sortBy(_._1)
         .map({ case (x, y, z) => x + " = " + Outer_Syntax.quote_string(y) + z + "\n" }).mkString
 
-    Options.PREFS_DIR.file.mkdirs()
+    Isabelle_System.mkdirs(Options.PREFS_DIR)
     Options.PREFS.file renameTo Options.PREFS_BACKUP.file
     File.write(Options.PREFS,
       "(* generated by Isabelle " + Calendar.getInstance.getTime + " *)\n\n" + prefs)
--- a/src/Pure/Tools/build.scala	Mon Jan 14 21:37:42 2013 +0100
+++ b/src/Pure/Tools/build.scala	Mon Jan 14 22:24:57 2013 +0100
@@ -424,7 +424,7 @@
     // global browser info dir
     if (info.options.bool("browser_info") && !(browser_info + Path.explode("index.html")).is_file)
     {
-      browser_info.file.mkdirs()
+      Isabelle_System.mkdirs(browser_info)
       File.copy(Path.explode("~~/lib/logo/isabelle.gif"),
         browser_info + Path.explode("isabelle.gif"))
       File.write(browser_info + Path.explode("index.html"),
@@ -614,7 +614,7 @@
       }
 
     // prepare log dir
-    (output_dir + LOG).file.mkdirs()
+    Isabelle_System.mkdirs(output_dir + LOG)
 
     // optional cleanup
     if (clean_build) {