mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-02 00:13:02 +00:00
Applications: Add a new Help app
This is a neat simple app that can display the Serenity manual ^)
This commit is contained in:
parent
6ec625d6f3
commit
02ee8cbbe2
Notes:
sideshowbarker
2024-07-19 11:55:04 +09:00
Author: https://github.com/bugaevc
Commit: 02ee8cbbe2
Pull-request: https://github.com/SerenityOS/serenity/pull/609
Reviewed-by: https://github.com/awesomekling ✅
12 changed files with 349 additions and 1 deletions
26
Applications/Help/ManualSectionNode.cpp
Normal file
26
Applications/Help/ManualSectionNode.cpp
Normal file
|
@ -0,0 +1,26 @@
|
|||
#include "ManualSectionNode.h"
|
||||
#include "ManualPageNode.h"
|
||||
#include <AK/String.h>
|
||||
#include <LibCore/CDirIterator.h>
|
||||
|
||||
String ManualSectionNode::path() const
|
||||
{
|
||||
return String::format("/usr/share/man/man%s", m_section.characters());
|
||||
}
|
||||
|
||||
void ManualSectionNode::reify_if_needed() const
|
||||
{
|
||||
if (m_reified)
|
||||
return;
|
||||
m_reified = true;
|
||||
|
||||
CDirIterator dir_iter { path(), CDirIterator::Flags::SkipDots };
|
||||
|
||||
while (dir_iter.has_next()) {
|
||||
String file_name = dir_iter.next_path();
|
||||
ASSERT(file_name.ends_with(".md"));
|
||||
String page_name = file_name.substring(0, file_name.length() - 3);
|
||||
NonnullOwnPtr<ManualNode> child = make<ManualPageNode>(*this, move(page_name));
|
||||
m_children.append(move(child));
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue