mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 09:24:57 +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
|
@ -25,11 +25,13 @@ int main(int argc, char** argv)
|
|||
args_parser.parse(argc, argv);
|
||||
|
||||
for (const char* path : paths) {
|
||||
auto destination = Core::File::read_link(path);
|
||||
if (destination.is_null()) {
|
||||
auto destination_or_error = Core::File::read_link(path);
|
||||
if (destination_or_error.is_error()) {
|
||||
perror(path);
|
||||
return 1;
|
||||
}
|
||||
|
||||
auto destination = destination_or_error.release_value();
|
||||
out("{}", destination);
|
||||
if (!no_newline)
|
||||
outln();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue