From 761a441805bef6e68da8d9a77c4d87d909facf65 Mon Sep 17 00:00:00 2001 From: Eugene Vigdorchik Date: Mon, 12 Nov 2012 14:22:36 +0400 Subject: [PATCH] Filter out null parent files when deleting empty directories. Closes #589. --- util/io/IO.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/io/IO.scala b/util/io/IO.scala index 68d7d28fa..b641a1545 100644 --- a/util/io/IO.scala +++ b/util/io/IO.scala @@ -331,7 +331,7 @@ object IO def deleteFilesEmptyDirs(files: Iterable[File]): Unit = { def isEmptyDirectory(dir: File) = dir.isDirectory && listFiles(dir).isEmpty - def parents(fs: Set[File]) = fs.map(_.getParentFile) + def parents(fs: Set[File]) = fs flatMap { f => Option(f.getParentFile) } def deleteEmpty(dirs: Set[File]) { val empty = dirs filter isEmptyDirectory