mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 21:27:34 +00:00
Minesweeper: Port to LibMain
Simplified two unveil() and two pledge() by using TRY().
This commit is contained in:
parent
0ed3520ef5
commit
a0c80a6f17
2 changed files with 9 additions and 21 deletions
|
@ -14,4 +14,4 @@ set(SOURCES
|
||||||
)
|
)
|
||||||
|
|
||||||
serenity_app(Minesweeper ICON app-minesweeper)
|
serenity_app(Minesweeper ICON app-minesweeper)
|
||||||
target_link_libraries(Minesweeper LibGUI LibConfig)
|
target_link_libraries(Minesweeper LibGUI LibConfig LibMain)
|
||||||
|
|
|
@ -18,34 +18,22 @@
|
||||||
#include <LibGUI/Menubar.h>
|
#include <LibGUI/Menubar.h>
|
||||||
#include <LibGUI/SeparatorWidget.h>
|
#include <LibGUI/SeparatorWidget.h>
|
||||||
#include <LibGUI/Window.h>
|
#include <LibGUI/Window.h>
|
||||||
|
#include <LibMain/Main.h>
|
||||||
|
#include <LibSystem/Wrappers.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
{
|
{
|
||||||
if (pledge("stdio rpath recvfd sendfd unix", nullptr) < 0) {
|
TRY(System::pledge("stdio rpath recvfd sendfd unix", nullptr));
|
||||||
perror("pledge");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto app = GUI::Application::construct(argc, argv);
|
auto app = GUI::Application::construct(arguments.argc, arguments.argv);
|
||||||
|
|
||||||
Config::pledge_domains("Minesweeper");
|
Config::pledge_domains("Minesweeper");
|
||||||
|
|
||||||
if (pledge("stdio rpath recvfd sendfd", nullptr) < 0) {
|
TRY(System::pledge("stdio rpath recvfd sendfd", nullptr));
|
||||||
perror("pledge");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (unveil("/res", "r") < 0) {
|
TRY(System::unveil("/res", "r"));
|
||||||
perror("unveil");
|
TRY(System::unveil(nullptr, nullptr));
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (unveil(nullptr, nullptr) < 0) {
|
|
||||||
perror("unveil");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto app_icon = GUI::Icon::default_icon("app-minesweeper");
|
auto app_icon = GUI::Icon::default_icon("app-minesweeper");
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue