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

Method copyDir

app/src/processing/app/Sketch.java:1148–1179  ·  view source on GitHub ↗
(File sourceDir, File targetDir,
                       long progress, long totalSize)

Source from the content-addressed store, hash-verified

1146
1147
1148 long copyDir(File sourceDir, File targetDir,
1149 long progress, long totalSize) throws IOException {
1150 // Overloaded copyDir so that the Save As progress bar gets updated when the
1151 // files are in folders as well (like in the data folder)
1152 if (sourceDir.equals(targetDir)) {
1153 final String urDum = "source and target directories are identical";
1154 throw new IllegalArgumentException(urDum);
1155 }
1156 targetDir.mkdirs();
1157 String files[] = sourceDir.list();
1158 for (String filename : files) {
1159 // Ignore dot files (.DS_Store), dot folders (.svn) while copying
1160 if (filename.charAt(0) == '.') {
1161 continue;
1162 }
1163
1164 File source = new File(sourceDir, filename);
1165 File target = new File(targetDir, filename);
1166 if (source.isDirectory()) {
1167 progress = copyDir(source, target, progress, totalSize);
1168 //progressBar.setValue((int) Math.min(Math.ceil(progress * 100.0 / totalSize), 100));
1169 setProgress((int) (100L * progress / totalSize));
1170 target.setLastModified(source.lastModified());
1171 } else {
1172 copyFile(source, target, progress, totalSize);
1173 progress += source.length();
1174 //progressBar.setValue((int) Math.min(Math.ceil(progress * 100.0 / totalSize), 100));
1175 setProgress((int) (100L * progress / totalSize));
1176 }
1177 }
1178 return progress;
1179 }
1180
1181
1182 @Override

Callers 1

doInBackgroundMethod · 0.95

Calls 5

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

Tested by

no test coverage detected