diff options
author | Kenneth Myhra <kennethmyhra@gmail.com> | 2022-03-23 16:36:03 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-03-24 11:57:51 +0100 |
commit | 4a57be824cc6d4fed95f182431ba807b2327395e (patch) | |
tree | 6f0185eb39bbf6cd199d30decd63bdbae655c3bb /Userland/Applications/FileManager | |
parent | 10093a67732431924fc76145443ffac157b50e01 (diff) | |
download | serenity-4a57be824cc6d4fed95f182431ba807b2327395e.zip |
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.
Diffstat (limited to 'Userland/Applications/FileManager')
-rw-r--r-- | Userland/Applications/FileManager/PropertiesWindow.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Userland/Applications/FileManager/PropertiesWindow.cpp b/Userland/Applications/FileManager/PropertiesWindow.cpp index ac83c0986f..45a6012f10 100644 --- a/Userland/Applications/FileManager/PropertiesWindow.cpp +++ b/Userland/Applications/FileManager/PropertiesWindow.cpp @@ -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] { |