- if (targetFile.exists() && !overwriteSources)
- continue copySources;
- copyResourceToFile(res, targetFile);
+ if (!targetFile.exists() || overwriteSources)
+ copyResourceToFile(res, targetFile);
+ if (!targetDir.equals(sourcesDir)) {
+ File fileInSourcesDir = new File(sourcesDir, targetFile
+ .getName());
+ if (!fileInSourcesDir.exists()
+ || !(fileInSourcesDir.length() == targetFile
+ .length()))
+ FileUtils.copyFile(targetFile, fileInSourcesDir);
+ }