From 98c0e0f841b24d548979bfd1566ada77be390a42 Mon Sep 17 00:00:00 2001 From: Matthijs Kooijman Date: Fri, 18 Dec 2015 17:29:42 +0100 Subject: [PATCH] Remove `Base.copyDir()` There was already a nearly identical `FileUtils.copy()` that copies directories recursively. The only difference is that now hidden files *are* copied, but version control files (according the list in FileUtils) are not. Since this only affects the copying of the "data" directory during save as, this should not be much of a problem. --- app/src/processing/app/Base.java | 28 -------------------- app/src/processing/app/SketchController.java | 2 +- 2 files changed, 1 insertion(+), 29 deletions(-) diff --git a/app/src/processing/app/Base.java b/app/src/processing/app/Base.java index 5bf085319..99ee9e674 100644 --- a/app/src/processing/app/Base.java +++ b/app/src/processing/app/Base.java @@ -2091,34 +2091,6 @@ public class Base { } - /** - * Copy a folder from one place to another. This ignores all dot files and - * folders found in the source directory, to avoid copying silly .DS_Store - * files and potentially troublesome .svn folders. - */ - static public void copyDir(File sourceDir, - File targetDir) throws IOException { - targetDir.mkdirs(); - String files[] = sourceDir.list(); - if (files == null) { - throw new IOException("Unable to list files from " + sourceDir); - } - for (String file : files) { - // Ignore dot files (.DS_Store), dot folders (.svn) while copying - if (file.charAt(0) == '.') continue; - //if (files[i].equals(".") || files[i].equals("..")) continue; - File source = new File(sourceDir, file); - File target = new File(targetDir, file); - if (source.isDirectory()) { - //target.mkdirs(); - copyDir(source, target); - target.setLastModified(source.lastModified()); - } else { - copyFile(source, target); - } - } - } - /** * Remove all files in a directory and the directory itself. diff --git a/app/src/processing/app/SketchController.java b/app/src/processing/app/SketchController.java index 2b817646b..81af6e1b0 100644 --- a/app/src/processing/app/SketchController.java +++ b/app/src/processing/app/SketchController.java @@ -582,7 +582,7 @@ public class SketchController { // re-copy the data folder (this may take a while.. add progress bar?) if (sketch.getDataFolder().exists()) { File newDataFolder = new File(newFolder, "data"); - Base.copyDir(sketch.getDataFolder(), newDataFolder); + FileUtils.copy(sketch.getDataFolder(), newDataFolder); } // save the main tab with its new name