feat: new "copyToDir" where inFilename/outFilename differs

This commit is contained in:
Connor Tumbleson 2019-04-26 11:14:08 -04:00
parent 73ac0d96fb
commit d068c3e481

View File

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