1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-08-13 17:03:45 -04:00

* support Java IO copy-move

This commit is contained in:
Reinhard Pointner 2011-12-27 02:26:40 +00:00
parent b82943439c
commit 827185d1f4

View File

@ -15,7 +15,6 @@ import java.io.StringWriter;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
@ -69,13 +68,14 @@ public final class FileUtilities {
private static void renameFileNIO2(File source, File destination) throws IOException {
Files.move(source.toPath(), destination.toPath());
java.nio.file.Files.move(source.toPath(), destination.toPath());
}
private static void renameFileIO(File source, File destination) throws IOException {
if (!source.renameTo(destination)) {
throw new IOException("Failed to rename file: " + source.getName());
// try using Guava IO utilities, that'll just copy files if renameTo() fails
com.google.common.io.Files.move(source, destination);
}
}