mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
LibGUI: Sort FileSystemModel alphabetically internally
This just makes everything nicer.
This commit is contained in:
parent
67f999b701
commit
0b9efc04b5
Notes:
sideshowbarker
2024-07-19 05:10:50 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/0b9efc04b56
1 changed files with 7 additions and 1 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue