mirror of
https://github.com/arduino/Arduino.git
synced 2025-03-13 10:29:35 +01:00
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.
This commit is contained in:
parent
0c62ac8985
commit
98c0e0f841
@ -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.
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user