Update to version 1.5.0 (breaking Bundle/Meta)
[nikiroo-utils.git] / src / be / nikiroo / utils / IOUtils.java
index 1b70b0e783cee077af91067a07e792b6eb5af993..b0566432aeb7fad7aae1938e7162a9810ed8ae2a 100644 (file)
@@ -5,7 +5,6 @@ import java.awt.geom.AffineTransform;
 import java.awt.image.AffineTransformOp;
 import java.awt.image.BufferedImage;
 import java.io.BufferedReader;
-import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
@@ -50,7 +49,7 @@ public class IOUtils {
         * 
         * @param in
         *            the data source
-        * @param target
+        * @param out
         *            the target {@link OutputStream}
         * 
         * @throws IOException
@@ -119,7 +118,7 @@ public class IOUtils {
         *            the source {@link File} (which can be a directory)
         * @param dest
         *            the destination <tt>.zip</tt> 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
         * 
@@ -203,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());
                }
        }
 
@@ -330,31 +324,6 @@ public class IOUtils {
                return image;
        }
 
-       /**
-        * Return the version of the program if it follows the VERSION convention
-        * (i.e., if it has a file called VERSION containing the version as a
-        * {@link String} on its binary root).
-        * 
-        * @return the version, or NULL
-        */
-       public static String getVersion() {
-               String version = null;
-
-               InputStream in = openResource("VERSION");
-               if (in != null) {
-                       try {
-                               ByteArrayOutputStream ba = new ByteArrayOutputStream();
-                               write(in, ba);
-                               in.close();
-
-                               version = ba.toString("UTF-8");
-                       } catch (IOException e) {
-                       }
-               }
-
-               return version;
-       }
-
        /**
         * Open the given /-separated resource (from the binary root).
         *