diff --git a/src/main/scala/util/FileUtil.scala b/src/main/scala/util/FileUtil.scala index 0f6103b..1386a05 100644 --- a/src/main/scala/util/FileUtil.scala +++ b/src/main/scala/util/FileUtil.scala @@ -60,4 +60,14 @@ case _ => "" } -} \ No newline at end of file + def withTmpDir[A](dir: File)(action: File => A): A = { + if(dir.exists()){ + FileUtils.deleteDirectory(dir) + } + try{ + action(dir) + }finally{ + FileUtils.deleteDirectory(dir) + } + } +}