mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 02:37:36 +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
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