diff options
author | Tim Schumacher <timschumi@gmx.de> | 2021-11-21 19:55:44 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-11-22 09:03:47 +0100 |
commit | 07351762c75e248d8bf77a2972e0527f02a7fa75 (patch) | |
tree | 9c4c1a5926aeda823e58bf45e2dcf8a325b71b9f | |
parent | 5f3e9886f713e9712abf8c1ac5b762ed6f89de3d (diff) | |
download | serenity-07351762c75e248d8bf77a2972e0527f02a7fa75.zip |
AK: Add LexicalPath::prepend()
-rw-r--r-- | AK/LexicalPath.cpp | 5 | ||||
-rw-r--r-- | AK/LexicalPath.h | 1 |
2 files changed, 6 insertions, 0 deletions
diff --git a/AK/LexicalPath.cpp b/AK/LexicalPath.cpp index 7864c13983..a80d11236d 100644 --- a/AK/LexicalPath.cpp +++ b/AK/LexicalPath.cpp @@ -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(".."); diff --git a/AK/LexicalPath.h b/AK/LexicalPath.h index d758e9ad19..54de349708 100644 --- a/AK/LexicalPath.h +++ b/AK/LexicalPath.h @@ -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); |