* auto-detect filelist-textfile vs normal-textfile and treat accordingly
This commit is contained in:
parent
332e4d1f93
commit
17aa158a72
|
@ -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)
|
// don't use new Scanner(File) because of BUG 6368019 (http://bugs.sun.com/view_bug.do?bug_id=6368019)
|
||||||
try {
|
try {
|
||||||
Scanner scanner = new Scanner(createTextReader(f));
|
Scanner scanner = new Scanner(createTextReader(f));
|
||||||
|
List<File> paths = new ArrayList<File>();
|
||||||
while (scanner.hasNextLine()) {
|
while (scanner.hasNextLine()) {
|
||||||
String line = scanner.nextLine().trim();
|
String line = scanner.nextLine().trim();
|
||||||
if (line.length() > 0) {
|
if (line.length() > 0) {
|
||||||
File path = new File(line);
|
File path = new File(line);
|
||||||
if (path.isAbsolute() && path.exists()) {
|
if (path.isAbsolute() && path.exists()) {
|
||||||
queue.add(0, path);
|
paths.add(path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
scanner.close();
|
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) {
|
} catch (Exception e) {
|
||||||
Logger.getLogger(FilesListTransferablePolicy.class.getName()).log(Level.WARNING, e.getMessage());
|
Logger.getLogger(FilesListTransferablePolicy.class.getName()).log(Level.WARNING, e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue