From 17aa158a721ea1f96df691f45010ef22eaaadedf Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Fri, 15 Mar 2013 01:20:37 +0000 Subject: [PATCH] * auto-detect filelist-textfile vs normal-textfile and treat accordingly --- .../filebot/ui/rename/FilesListTransferablePolicy.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/source/net/sourceforge/filebot/ui/rename/FilesListTransferablePolicy.java b/source/net/sourceforge/filebot/ui/rename/FilesListTransferablePolicy.java index 186a792f..6fe95270 100644 --- a/source/net/sourceforge/filebot/ui/rename/FilesListTransferablePolicy.java +++ b/source/net/sourceforge/filebot/ui/rename/FilesListTransferablePolicy.java @@ -76,16 +76,23 @@ class FilesListTransferablePolicy extends FileTransferablePolicy { // don't use new Scanner(File) because of BUG 6368019 (http://bugs.sun.com/view_bug.do?bug_id=6368019) try { Scanner scanner = new Scanner(createTextReader(f)); + List paths = new ArrayList(); while (scanner.hasNextLine()) { String line = scanner.nextLine().trim(); if (line.length() > 0) { File path = new File(line); if (path.isAbsolute() && path.exists()) { - queue.add(0, path); + paths.add(path); } } } scanner.close(); + + if (paths.isEmpty()) { + entries.add(f); // treat as simple text file + } else { + queue.addAll(0, paths); // add paths from text file + } } catch (Exception e) { Logger.getLogger(FilesListTransferablePolicy.class.getName()).log(Level.WARNING, e.getMessage()); }