mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 01:20:25 +00:00
Kernel: Add FileDescription::try_serialize_absolute_path()
Unlike FileDescription::absolute_path(), this knows that failures can happen and will propagate them to the caller.
This commit is contained in:
parent
a27c6f5226
commit
cae20d2aa9
Notes:
sideshowbarker
2024-07-18 04:31:57 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/cae20d2aa9a
2 changed files with 9 additions and 0 deletions
|
@ -344,6 +344,14 @@ KResult FileDescription::close()
|
|||
return m_file->close();
|
||||
}
|
||||
|
||||
KResultOr<NonnullOwnPtr<KString>> FileDescription::try_serialize_absolute_path()
|
||||
{
|
||||
if (m_custody)
|
||||
return m_custody->try_serialize_absolute_path();
|
||||
// FIXME: Don't go through a String here!
|
||||
return KString::try_create(m_file->absolute_path(*this));
|
||||
}
|
||||
|
||||
String FileDescription::absolute_path() const
|
||||
{
|
||||
if (m_custody)
|
||||
|
|
|
@ -64,6 +64,7 @@ public:
|
|||
|
||||
KResultOr<NonnullOwnPtr<KBuffer>> read_entire_file();
|
||||
|
||||
KResultOr<NonnullOwnPtr<KString>> try_serialize_absolute_path();
|
||||
String absolute_path() const;
|
||||
|
||||
bool is_direct() const { return m_direct; }
|
||||
|
|
Loading…
Reference in a new issue