parent
11728b7db5
commit
029572b6fd
Notes:
sideshowbarker
2024-07-19 07:21:28 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/029572b6fd6
1 changed files with 8 additions and 3 deletions
|
@ -27,6 +27,7 @@
|
|||
#include "ManualSectionNode.h"
|
||||
#include "ManualPageNode.h"
|
||||
#include <AK/FileSystemPath.h>
|
||||
#include <AK/QuickSort.h>
|
||||
#include <AK/String.h>
|
||||
#include <LibCore/DirIterator.h>
|
||||
|
||||
|
@ -43,12 +44,16 @@ void ManualSectionNode::reify_if_needed() const
|
|||
|
||||
Core::DirIterator dir_iter { path(), Core::DirIterator::Flags::SkipDots };
|
||||
|
||||
Vector<String> page_names;
|
||||
while (dir_iter.has_next()) {
|
||||
FileSystemPath file_path(dir_iter.next_path());
|
||||
if (file_path.extension() != "md")
|
||||
continue;
|
||||
String page_name = file_path.title();
|
||||
NonnullOwnPtr<ManualNode> child = make<ManualPageNode>(*this, move(page_name));
|
||||
m_children.append(move(child));
|
||||
page_names.append(file_path.title());
|
||||
}
|
||||
|
||||
quick_sort(page_names);
|
||||
|
||||
for (auto& page_name : page_names)
|
||||
m_children.append(make<ManualPageNode>(*this, move(page_name)));
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue