mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 08:07:34 +00:00
Help+LibManual: Move all manpage path handling to LibManual
This way, we'll have an easier time changing these paths.
This commit is contained in:
parent
16ca41ec10
commit
a438c4d568
6 changed files with 66 additions and 14 deletions
|
@ -1,5 +1,6 @@
|
|||
set(SOURCES
|
||||
PageNode.cpp
|
||||
Path.cpp
|
||||
SectionNode.cpp
|
||||
)
|
||||
|
||||
|
|
13
Userland/Libraries/LibManual/Path.cpp
Normal file
13
Userland/Libraries/LibManual/Path.cpp
Normal file
|
@ -0,0 +1,13 @@
|
|||
/*
|
||||
* Copyright (c) 2022, kleines Filmröllchen <filmroellchen@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include "Path.h"
|
||||
|
||||
namespace Manual {
|
||||
|
||||
LexicalPath const manual_base_path { "/usr/share/man" };
|
||||
|
||||
}
|
17
Userland/Libraries/LibManual/Path.h
Normal file
17
Userland/Libraries/LibManual/Path.h
Normal file
|
@ -0,0 +1,17 @@
|
|||
/*
|
||||
* Copyright (c) 2022, the SerenityOS developers.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/LexicalPath.h>
|
||||
|
||||
namespace Manual {
|
||||
|
||||
extern LexicalPath const manual_base_path;
|
||||
|
||||
constexpr StringView const top_level_section_prefix = "man"sv;
|
||||
|
||||
}
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include "SectionNode.h"
|
||||
#include "PageNode.h"
|
||||
#include "Path.h"
|
||||
#include <AK/LexicalPath.h>
|
||||
#include <AK/QuickSort.h>
|
||||
#include <LibCore/DirIterator.h>
|
||||
|
@ -14,7 +15,7 @@ namespace Manual {
|
|||
|
||||
ErrorOr<String> SectionNode::path() const
|
||||
{
|
||||
return String::formatted("/usr/share/man/man{}", m_section);
|
||||
return String::formatted("{}/{}{}", manual_base_path, top_level_section_prefix, m_section);
|
||||
}
|
||||
|
||||
ErrorOr<String> SectionNode::name() const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue