summaryrefslogtreecommitdiff
path: root/Libraries/LibGUI
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-07-04 20:33:23 +0200
committerAndreas Kling <kling@serenityos.org>2020-07-04 20:33:23 +0200
commit0b9efc04b56af53425afdc27b20ac0ad142ca9ab (patch)
tree3f18457630abce80d242eb690d8fd0b8c160290c /Libraries/LibGUI
parent67f999b701fe66a41ee5e7f362b04bfc3492409e (diff)
downloadserenity-0b9efc04b56af53425afdc27b20ac0ad142ca9ab.zip
LibGUI: Sort FileSystemModel alphabetically internally
This just makes everything nicer.
Diffstat (limited to 'Libraries/LibGUI')
-rw-r--r--Libraries/LibGUI/FileSystemModel.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/Libraries/LibGUI/FileSystemModel.cpp b/Libraries/LibGUI/FileSystemModel.cpp
index 71ee61b09c..0d9fad32a0 100644
--- a/Libraries/LibGUI/FileSystemModel.cpp
+++ b/Libraries/LibGUI/FileSystemModel.cpp
@@ -25,6 +25,7 @@
*/
#include <AK/LexicalPath.h>
+#include <AK/QuickSort.h>
#include <AK/StringBuilder.h>
#include <LibCore/DirIterator.h>
#include <LibCore/File.h>
@@ -97,8 +98,13 @@ void FileSystemModel::Node::traverse_if_needed(const FileSystemModel& model)
return;
}
+ Vector<String> child_names;
while (di.has_next()) {
- String name = di.next_path();
+ child_names.append(di.next_path());
+ }
+ quick_sort(child_names);
+
+ for (auto& name : child_names) {
String child_path = String::format("%s/%s", full_path.characters(), name.characters());
NonnullOwnPtr<Node> child = make<Node>();
bool ok = child->fetch_data(child_path, false);