mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-10 01:51:03 +09:00
LibCore+ImageViewer: Add unlink() wrapper, use it
This commit is contained in:
parent
080c3164c7
commit
9a38d1de07
Notes:
sideshowbarker
2024-07-17 21:32:44 +09:00
Author: https://github.com/juniorrantila
Commit: 9a38d1de07
Pull-request: https://github.com/SerenityOS/serenity/pull/11492
3 changed files with 20 additions and 3 deletions
|
@ -131,10 +131,10 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
if (msgbox_result == GUI::MessageBox::ExecCancel)
|
||||
return;
|
||||
|
||||
if (unlink(widget.path().characters()) < 0) {
|
||||
int saved_errno = errno;
|
||||
auto unlinked_or_error = Core::System::unlink(widget.path());
|
||||
if (unlinked_or_error.is_error()) {
|
||||
GUI::MessageBox::show(window,
|
||||
String::formatted("unlink({}) failed: {}", path, strerror(saved_errno)),
|
||||
String::formatted("unlink({}) failed: {}", path, unlinked_or_error.error()),
|
||||
"Delete failed",
|
||||
GUI::MessageBox::Type::Error);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue