From 8efd30ab386be74440523c6d17a3447316cfd5a6 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Wed, 28 Sep 2016 23:40:41 +0800 Subject: [PATCH] Use human sort order for all paths loaded into the UI --- .../filebot/ui/rename/FilesListTransferablePolicy.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/net/filebot/ui/rename/FilesListTransferablePolicy.java b/source/net/filebot/ui/rename/FilesListTransferablePolicy.java index 2d573c7f..3e63a080 100644 --- a/source/net/filebot/ui/rename/FilesListTransferablePolicy.java +++ b/source/net/filebot/ui/rename/FilesListTransferablePolicy.java @@ -10,10 +10,10 @@ import static net.filebot.util.RegularExpressions.*; import java.awt.datatransfer.Transferable; import java.io.File; import java.util.Collection; +import java.util.LinkedHashSet; import java.util.List; import java.util.Objects; import java.util.Set; -import java.util.TreeSet; import java.util.logging.Level; import net.filebot.media.MediaDetection; @@ -51,13 +51,13 @@ class FilesListTransferablePolicy extends BackgroundFileTransferablePolicy @Override protected void load(List files, TransferAction action) { - Set fileset = new TreeSet(CASE_INSENSITIVE_ORDER); + Set fileset = new LinkedHashSet(); // load files recursively by default load(files, action != TransferAction.LINK, fileset); // use fast file to minimize system calls like length(), isDirectory(), isFile(), ... and list files in human order - publish(fileset.stream().sorted(HUMAN_ORDER).map(FastFile::new).toArray(File[]::new)); + publish(fileset.stream().map(FastFile::new).toArray(File[]::new)); } private void load(List files, boolean recursive, Collection sink) { @@ -92,7 +92,7 @@ class FilesListTransferablePolicy extends BackgroundFileTransferablePolicy // load folders recursively else if (f.isDirectory()) { - load(getChildren(f, NOT_HIDDEN), true, sink); // FORCE NATURAL FILE ORDER + load(getChildren(f, NOT_HIDDEN, HUMAN_ORDER), true, sink); // FORCE NATURAL FILE ORDER } } }