From 47ab6f6b966c7ee77da2ad0c82e6723e615264ba Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Mon, 21 Mar 2016 15:29:27 +0000 Subject: [PATCH] SFV: auto-detect common root folder from dropped fileset --- .../sfv/ChecksumTableTransferablePolicy.java | 51 ++++++++++++++----- source/net/filebot/util/FileSet.java | 36 ++++++++++--- 2 files changed, 68 insertions(+), 19 deletions(-) diff --git a/source/net/filebot/ui/sfv/ChecksumTableTransferablePolicy.java b/source/net/filebot/ui/sfv/ChecksumTableTransferablePolicy.java index 8599abca..7a3aacb6 100644 --- a/source/net/filebot/ui/sfv/ChecksumTableTransferablePolicy.java +++ b/source/net/filebot/ui/sfv/ChecksumTableTransferablePolicy.java @@ -11,6 +11,7 @@ import static net.filebot.util.ui.SwingUI.*; import java.io.File; import java.io.IOException; +import java.nio.file.Path; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -24,6 +25,7 @@ import net.filebot.hash.VerificationFileReader; import net.filebot.mac.MacAppUtilities; import net.filebot.ui.transfer.BackgroundFileTransferablePolicy; import net.filebot.util.ExceptionUtilities; +import net.filebot.util.FileSet; class ChecksumTableTransferablePolicy extends BackgroundFileTransferablePolicy { @@ -84,20 +86,42 @@ class ChecksumTableTransferablePolicy extends BackgroundFileTransferablePolicy> it : fileset.getRoots().entrySet()) { + File root = it.getKey().toFile(); + for (Path path : it.getValue()) { + File relativeFile = path.toFile().getParentFile(); + File absoluteFile = new File(root, path.toString()); + load(absoluteFile, relativeFile, root); + } } } catch (InterruptedException e) { // supposed to happen if background execution is aborted @@ -120,8 +144,9 @@ class ChecksumTableTransferablePolicy extends BackgroundFileTransferablePolicy entry = parser.next(); @@ -140,12 +165,14 @@ class ChecksumTableTransferablePolicy extends BackgroundFileTransferablePolicy