MCPcopy Index your code
hub / github.com/processing/processing / copyDir

Method copyDir

app/src/processing/app/Util.java:236–258  ·  view source on GitHub ↗

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.

(File sourceDir,
                             File targetDir)

Source from the content-addressed store, hash-verified

234 * files and potentially troublesome .svn folders.
235 */
236 static public void copyDir(File sourceDir,
237 File targetDir) throws IOException {
238 if (sourceDir.equals(targetDir)) {
239 final String urDum = "source and target directories are identical";
240 throw new IllegalArgumentException(urDum);
241 }
242 targetDir.mkdirs();
243 String files[] = sourceDir.list();
244 for (int i = 0; i < files.length; i++) {
245 // Ignore dot files (.DS_Store), dot folders (.svn) while copying
246 if (files[i].charAt(0) == '.') continue;
247 //if (files[i].equals(".") || files[i].equals("..")) continue;
248 File source = new File(sourceDir, files[i]);
249 File target = new File(targetDir, files[i]);
250 if (source.isDirectory()) {
251 //target.mkdirs();
252 copyDir(source, target);
253 target.setLastModified(source.lastModified());
254 } else {
255 copyFile(source, target);
256 }
257 }
258 }
259
260
261 static public void copyDirNative(File sourceDir,

Callers 4

addTemplateFilesMethod · 0.95
copyAndLoadMethod · 0.95
backupMethod · 0.95
exportApplicationMethod · 0.95

Calls 4

copyFileMethod · 0.95
setLastModifiedMethod · 0.80
equalsMethod · 0.45
listMethod · 0.45

Tested by

no test coverage detected