mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 03:57:43 +00:00
Userland+Tests: Convert File::read_link() from String to ErrorOr<String>
This converts the return value of File::read_link() from String to ErrorOr<String>. The rest of the change is to support the potential of an Error being returned and subsequent release of the value when no Error is returned. Unfortunately at this stage none of the places affected can utililize our TRY() macro.
This commit is contained in:
parent
10093a6773
commit
4a57be824c
12 changed files with 72 additions and 30 deletions
|
@ -232,7 +232,11 @@ Icon FileIconProvider::icon_for_path(const String& path, mode_t mode)
|
|||
return s_directory_icon;
|
||||
}
|
||||
if (S_ISLNK(mode)) {
|
||||
auto raw_symlink_target = Core::File::read_link(path);
|
||||
auto raw_symlink_target_or_error = Core::File::read_link(path);
|
||||
if (raw_symlink_target_or_error.is_error())
|
||||
return s_symlink_icon;
|
||||
|
||||
auto raw_symlink_target = raw_symlink_target_or_error.release_value();
|
||||
if (raw_symlink_target.is_null())
|
||||
return s_symlink_icon;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue