mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 09:14:58 +00:00
shot: Port to Core::Stream
This commit is contained in:
parent
84e817a9f2
commit
f22d7ddd98
1 changed files with 3 additions and 5 deletions
|
@ -13,6 +13,7 @@
|
|||
#include <LibCore/DateTime.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/Process.h>
|
||||
#include <LibCore/Stream.h>
|
||||
#include <LibGUI/Application.h>
|
||||
#include <LibGUI/Clipboard.h>
|
||||
#include <LibGUI/ConnectionToWindowServer.h>
|
||||
|
@ -158,17 +159,14 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
if (edit_image)
|
||||
output_path = Core::DateTime::now().to_string("/tmp/screenshot-%Y-%m-%d-%H-%M-%S.png"sv);
|
||||
|
||||
auto file_or_error = Core::File::open(output_path, Core::OpenMode::ReadWrite);
|
||||
auto file_or_error = Core::Stream::File::open(output_path, Core::Stream::OpenMode::ReadWrite);
|
||||
if (file_or_error.is_error()) {
|
||||
warnln("Could not open '{}' for writing: {}", output_path, file_or_error.error());
|
||||
return 1;
|
||||
}
|
||||
|
||||
auto& file = *file_or_error.value();
|
||||
if (!file.write(encoded_bitmap.data(), encoded_bitmap.size())) {
|
||||
warnln("Failed to write PNG");
|
||||
return 1;
|
||||
}
|
||||
TRY(file.write(encoded_bitmap.bytes()));
|
||||
|
||||
if (edit_image)
|
||||
TRY(Core::Process::spawn("/bin/PixelPaint"sv, Array { output_path }));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue