X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Futils%2FIOUtils.java;h=b0566432aeb7fad7aae1938e7162a9810ed8ae2a;hb=632cc690ac07130a51a947ee0f0b2bfae10b6595;hp=eb105e2698535e325ed602fc0b3ed50f7e0b16b4;hpb=32ae20790403c7bce40bf278db8ca0258623945c;p=nikiroo-utils.git diff --git a/src/be/nikiroo/utils/IOUtils.java b/src/be/nikiroo/utils/IOUtils.java index eb105e2..b056643 100644 --- a/src/be/nikiroo/utils/IOUtils.java +++ b/src/be/nikiroo/utils/IOUtils.java @@ -49,7 +49,7 @@ public class IOUtils { * * @param in * the data source - * @param target + * @param out * the target {@link OutputStream} * * @throws IOException @@ -118,7 +118,7 @@ public class IOUtils { * the source {@link File} (which can be a directory) * @param dest * the destination .zip file - * @param srctIsRoot + * @param srcIsRoot * FALSE if we need to add a {@link ZipEntry} for src, TRUE to * add it at the root of the ZIP * @@ -202,20 +202,15 @@ public class IOUtils { * the target to delete */ public static void deltree(File target) { - for (File file : target.listFiles()) { - if (file.isDirectory()) { + File[] files = target.listFiles(); + if (files != null) { + for (File file : files) { deltree(file); - } else { - if (!file.delete()) { - System.err.println("Cannot delete file: " - + file.getAbsolutePath()); - } } } if (!target.delete()) { - System.err.println("Cannot delete file: " - + target.getAbsolutePath()); + System.err.println("Cannot delete: " + target.getAbsolutePath()); } }