mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:28:10 +00:00
LibFileSystemAccessClient+CrashReporter: Introduce FSAC::File and use it
The new result returned just a file stream, which wasn't sufficient enough for most applications because it didn't provide a filename. This patch will make a new File object that has both a file stream and a filename.
This commit is contained in:
parent
247db3fdd0
commit
2cbe2dd3c0
3 changed files with 27 additions and 3 deletions
|
@ -205,9 +205,14 @@ void Client::handle_prompt_end(i32 request_id, i32 error, Optional<IPC::File> co
|
|||
return;
|
||||
}
|
||||
|
||||
auto file_or_error = Core::Stream::File::adopt_fd(ipc_file->take_fd(), Core::Stream::OpenMode::ReadWrite);
|
||||
auto file_or_error = [&]() -> ErrorOr<File> {
|
||||
auto stream = TRY(Core::Stream::File::adopt_fd(ipc_file->take_fd(), Core::Stream::OpenMode::ReadWrite));
|
||||
auto filename = TRY(String::from_deprecated_string(*chosen_file));
|
||||
return File({}, move(stream), filename);
|
||||
}();
|
||||
if (file_or_error.is_error()) {
|
||||
resolve_any_promise(file_or_error.release_error());
|
||||
return;
|
||||
}
|
||||
|
||||
request_data.promise.get<PromiseType<Result>>()->resolve(file_or_error.release_value());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue