mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-31 21:29:06 +00:00
LibWebView: Use the download directory facility for saving files
This commit is contained in:
parent
bf2dad5d38
commit
03f9915054
Notes:
github-actions[bot]
2024-09-03 18:14:32 +00:00
Author: https://github.com/trflynn89
Commit: 03f9915054
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1219
2 changed files with 13 additions and 5 deletions
|
@ -11,6 +11,7 @@
|
|||
#include <LibCore/Timer.h>
|
||||
#include <LibGfx/ImageFormats/PNGWriter.h>
|
||||
#include <LibWeb/Infra/Strings.h>
|
||||
#include <LibWebView/Application.h>
|
||||
#include <LibWebView/ViewImplementation.h>
|
||||
|
||||
#ifdef AK_OS_MACOS
|
||||
|
@ -510,8 +511,8 @@ static ErrorOr<LexicalPath> save_screenshot(Gfx::ShareableBitmap const& bitmap)
|
|||
if (!bitmap.is_valid())
|
||||
return Error::from_string_view("Failed to take a screenshot"sv);
|
||||
|
||||
LexicalPath path { Core::StandardPaths::downloads_directory() };
|
||||
path = path.append(TRY(Core::DateTime::now().to_string("screenshot-%Y-%m-%d-%H-%M-%S.png"sv)));
|
||||
auto file = Core::DateTime::now().to_byte_string("screenshot-%Y-%m-%d-%H-%M-%S.png"sv);
|
||||
auto path = TRY(Application::the().path_for_downloaded_file(file));
|
||||
|
||||
auto encoded = TRY(Gfx::PNGWriter::encode(*bitmap.bitmap()));
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue