feat: new "copyToDir" where inFilename/outFilename differs
@@ -41,17 +41,19 @@ public class DirUtil {
public static void copyToDir(Directory in, Directory out, String fileName)
throws DirectoryException {
+ copyToDir(in, out, fileName, fileName);
+ }
+
+ public static void copyToDir(Directory in, Directory out, String inFile, String outFile)
+ throws DirectoryException {
try {
- if (in.containsDir(fileName)) {
- // TODO: remove before copying
- in.getDir(fileName).copyToDir(out.createDir(fileName));
+ if (in.containsDir(inFile)) {
+ in.getDir(inFile).copyToDir(out.createDir(outFile));
} else {
- BrutIO.copyAndClose(in.getFileInput(fileName),
- out.getFileOutput(fileName));
+ BrutIO.copyAndClose(in.getFileInput(inFile), out.getFileOutput(outFile));
}
} catch (IOException ex) {
- throw new DirectoryException(
- "Error copying file: " + fileName, ex);
+ throw new DirectoryException("Error copying file: " + inFile, ex);
}
}
