mirror of
https://github.com/RGBCube/serenity
synced 2025-05-22 11:55:07 +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
2 changed files with 9 additions and 0 deletions
|
@ -344,6 +344,14 @@ KResult FileDescription::close()
|
||||||
return m_file->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
|
String FileDescription::absolute_path() const
|
||||||
{
|
{
|
||||||
if (m_custody)
|
if (m_custody)
|
||||||
|
|
|
@ -64,6 +64,7 @@ public:
|
||||||
|
|
||||||
KResultOr<NonnullOwnPtr<KBuffer>> read_entire_file();
|
KResultOr<NonnullOwnPtr<KBuffer>> read_entire_file();
|
||||||
|
|
||||||
|
KResultOr<NonnullOwnPtr<KString>> try_serialize_absolute_path();
|
||||||
String absolute_path() const;
|
String absolute_path() const;
|
||||||
|
|
||||||
bool is_direct() const { return m_direct; }
|
bool is_direct() const { return m_direct; }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue