mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:27:35 +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
|
@ -95,10 +95,11 @@ PropertiesWindow::PropertiesWindow(String const& path, bool disable_rename, Wind
|
|||
};
|
||||
|
||||
if (S_ISLNK(m_mode)) {
|
||||
auto link_destination = Core::File::read_link(path);
|
||||
if (link_destination.is_null()) {
|
||||
auto link_destination_or_error = Core::File::read_link(path);
|
||||
if (link_destination_or_error.is_error()) {
|
||||
perror("readlink");
|
||||
} else {
|
||||
auto link_destination = link_destination_or_error.release_value();
|
||||
auto link_location = general_tab.find_descendant_of_type_named<GUI::LinkLabel>("link_location");
|
||||
link_location->set_text(link_destination);
|
||||
link_location->on_click = [link_destination] {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue