AK: Add LexicalPath::prepend()

This commit is contained in:
Tim Schumacher 2021-11-21 19:55:44 +01:00 committed by Andreas Kling
parent 5f3e9886f7
commit 07351762c7
Notes: sideshowbarker 2024-07-18 00:53:01 +09:00
2 changed files with 6 additions and 0 deletions

View File

@ -164,6 +164,11 @@ LexicalPath LexicalPath::append(StringView value) const
return LexicalPath::join(m_string, value);
}
LexicalPath LexicalPath::prepend(StringView value) const
{
return LexicalPath::join(value, m_string);
}
LexicalPath LexicalPath::parent() const
{
return append("..");

View File

@ -30,6 +30,7 @@ public:
bool has_extension(StringView) const;
[[nodiscard]] LexicalPath append(StringView) const;
[[nodiscard]] LexicalPath prepend(StringView) const;
[[nodiscard]] LexicalPath parent() const;
[[nodiscard]] static String canonicalized_path(String);