FileSystemAccessServer: Use ECANCELED instead of -1

-1 was used when the user cancel the dialog, `ECANCELED` is a bit more
explicit about what it is.
This commit is contained in:
Lucas CHOLLET 2023-05-04 21:45:24 -04:00 committed by Sam Atkins
parent 8bb2663a22
commit 5a4c61838f
2 changed files with 2 additions and 2 deletions

View file

@ -122,7 +122,7 @@ void Client::handle_prompt_end(i32 request_id, i32 error, Optional<IPC::File> co
if (error != 0) {
// We don't want to show an error message for non-existent files since some applications may want
// to handle it as opening a new, named file.
if (error != -1 && error != ENOENT)
if (error != ECANCELED && error != ENOENT)
GUI::MessageBox::show_error(request_data.parent_window, DeprecatedString::formatted("Opening \"{}\" failed: {}", *chosen_file, strerror(error)));
request_data.promise->resolve(Error::from_errno(error)).release_value_but_fixme_should_propagate_errors();
return;

View file

@ -156,7 +156,7 @@ void ConnectionFromClient::prompt_helper(i32 request_id, Optional<DeprecatedStri
async_handle_prompt_end(request_id, 0, IPC::File(*file.release_value(), IPC::File::CloseAfterSending), user_picked_file);
}
} else {
async_handle_prompt_end(request_id, -1, Optional<IPC::File> {}, Optional<DeprecatedString> {});
async_handle_prompt_end(request_id, ECANCELED, Optional<IPC::File> {}, Optional<DeprecatedString> {});
}
}