Require a set of distinct files

# Fixes https://www.filebot.net/forums/viewtopic.php?f=6&t=5108
This commit is contained in:
Reinhard Pointner 2017-06-11 03:21:42 +08:00
parent 5087d72f8e
commit 422b9e2417
1 changed files with 8 additions and 1 deletions

View File

@ -48,8 +48,15 @@ public class AutoDetection {
private Locale locale;
public AutoDetection(Collection<File> root, boolean resolve, Locale locale) {
this.files = (resolve ? resolve(root.stream().map(FastFile::new), getSystemFilesFilter()) : root.stream()).toArray(File[]::new);
this.locale = locale;
// require a set of distinct files
this.files = root.stream().sorted().distinct().map(FastFile::new).toArray(File[]::new);
// resolve folders if required
if (resolve) {
this.files = resolve(stream(files), getSystemFilesFilter()).toArray(File[]::new);
}
}
protected Stream<File> resolve(Stream<File> root, FileFilter excludes) {