Skip to content

Commit 7fafad4

Browse files
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 0cb6c0e commit 7fafad4

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
@@ -2123,34 +2123,6 @@ static public void saveFile(String str, File file) throws IOException {
21232123
}
21242124

21252125

2126-
/**
2127-
* Copy a folder from one place to another. This ignores all dot files and
2128-
* folders found in the source directory, to avoid copying silly .DS_Store
2129-
* files and potentially troublesome .svn folders.
2130-
*/
2131-
static public void copyDir(File sourceDir,
2132-
File targetDir) throws IOException {
2133-
targetDir.mkdirs();
2134-
String files[] = sourceDir.list();
2135-
if (files == null) {
2136-
throw new IOException("Unable to list files from " + sourceDir);
2137-
}
2138-
for (String file : files) {
2139-
// Ignore dot files (.DS_Store), dot folders (.svn) while copying
2140-
if (file.charAt(0) == '.') continue;
2141-
//if (files[i].equals(".") || files[i].equals("..")) continue;
2142-
File source = new File(sourceDir, file);
2143-
File target = new File(targetDir, file);
2144-
if (source.isDirectory()) {
2145-
//target.mkdirs();
2146-
copyDir(source, target);
2147-
target.setLastModified(source.lastModified());
2148-
} else {
2149-
copyFile(source, target);
2150-
}
2151-
}
2152-
}
2153-
21542126

21552127
/**
21562128
* 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
@@ -583,7 +583,7 @@ protected boolean saveAs() throws IOException {
583583
// re-copy the data folder (this may take a while.. add progress bar?)
584584
if (sketch.getDataFolder().exists()) {
585585
File newDataFolder = new File(newFolder, "data");
586-
Base.copyDir(sketch.getDataFolder(), newDataFolder);
586+
FileUtils.copy(sketch.getDataFolder(), newDataFolder);
587587
}
588588

589589
// save the main tab with its new name

0 commit comments

Comments
 (0)