Commits

Thibaut Colar committed 74de309

FileUtils.mkDirs

Comments (0)

Files changed (2)

netColarUtils/build.fan

     podName = "netColarUtils"
     summary = "Various reusable famtom utils"
     depends = ["sys 1.0+", "util 1.0+"]
-    version = Version("0.0.2")
+    version = Version("1.0.0")
     srcDirs = [`fan/`, `test/`]
-    meta = ["license.name" : "MIT", "vcs.uri" : "https://bitbucket.org/tcolar/fantomutils/src/tip/netColarUtils"]  
+    meta = ["license.name" : "MIT", "vcs.uri" : "https://bitbucket.org/tcolar/fantomutils/src/tip/netColarUtils"]
   }
-}
+}

netColarUtils/fan/FileUtils.fan

+// History:
+//   11 13 12 Creation
+
+**
+** FileUtils
+**
+class FileUtils
+{
+  ** Create a directory along with whatever parent directories are needed
+  static Void mkDirs(Uri dir)
+  {
+    if(!dir.isDir)
+      dir= dir.plusSlash
+    f := File(dir)
+    if(! f.exists)
+    {
+      mkDirs(dir.parent)
+      f.create()
+    }
+  }
+}