Skip to content

Commit 98c0e0f

Browse files
matthijskooijmanfacchinm
authored andcommitted
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.
1 parent 0c62ac8 commit 98c0e0f

File tree

2 files changed

+1
-29
lines changed

2 files changed

+1
-29
lines changed

app/src/processing/app/Base.java

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2091,34 +2091,6 @@ static public void saveFile(String str, File file) throws IOException {
20912091
}
20922092

20932093

2094-
/**
2095-
* Copy a folder from one place to another. This ignores all dot files and
2096-
* folders found in the source directory, to avoid copying silly .DS_Store
2097-
* files and potentially troublesome .svn folders.
2098-
*/
2099-
static public void copyDir(File sourceDir,
2100-
File targetDir) throws IOException {
2101-
targetDir.mkdirs();
2102-
String files[] = sourceDir.list();
2103-
if (files == null) {
2104-
throw new IOException("Unable to list files from " + sourceDir);
2105-
}
2106-
for (String file : files) {
2107-
// Ignore dot files (.DS_Store), dot folders (.svn) while copying
2108-
if (file.charAt(0) == '.') continue;
2109-
//if (files[i].equals(".") || files[i].equals("..")) continue;
2110-
File source = new File(sourceDir, file);
2111-
File target = new File(targetDir, file);
2112-
if (source.isDirectory()) {
2113-
//target.mkdirs();
2114-
copyDir(source, target);
2115-
target.setLastModified(source.lastModified());
2116-
} else {
2117-
copyFile(source, target);
2118-
}
2119-
}
2120-
}
2121-
21222094

21232095
/**
21242096
* Remove all files in a directory and the directory itself.

app/src/processing/app/SketchController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ protected boolean saveAs() throws IOException {
582582
// re-copy the data folder (this may take a while.. add progress bar?)
583583
if (sketch.getDataFolder().exists()) {
584584
File newDataFolder = new File(newFolder, "data");
585-
Base.copyDir(sketch.getDataFolder(), newDataFolder);
585+
FileUtils.copy(sketch.getDataFolder(), newDataFolder);
586586
}
587587

588588
// save the main tab with its new name

0 commit comments

Comments
 (0)