mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-10 19:46:03 +00:00
Kernel: Add KLexicalPath::try_join and use it
This adds KLexicalPath::try_join(). As this cannot be done without allocation, it uses KString and can fail. This patch also uses it at one place. All the other cases of String::formatted("{}/{}", ...) currently rely on the return value being a String, which means they cannot easily be converted to use the new API.
This commit is contained in:
parent
ee342f5ec3
commit
1f792faf34
Notes:
sideshowbarker
2024-07-18 10:14:13 +09:00
Author: https://github.com/MaxWipfli
Commit: 1f792faf34
Pull-request: https://github.com/SerenityOS/serenity/pull/8492
Reviewed-by: https://github.com/alimpfard
3 changed files with 35 additions and 1 deletions
|
@ -7,6 +7,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/StringView.h>
|
||||
#include <Kernel/KString.h>
|
||||
|
||||
namespace Kernel::KLexicalPath {
|
||||
|
||||
|
@ -16,4 +17,6 @@ StringView basename(StringView const&);
|
|||
StringView dirname(StringView const&);
|
||||
Vector<StringView> parts(StringView const&);
|
||||
|
||||
OwnPtr<KString> try_join(StringView const&, StringView const&);
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue