mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 07:27:45 +00:00
Snake: Port to LibMain
Simplified two pledge() and two unveil() by using TRY().
This commit is contained in:
parent
02a7cfaad6
commit
c4e49e1955
2 changed files with 9 additions and 21 deletions
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include "SnakeGame.h"
|
||||
#include <LibConfig/Client.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibGUI/Action.h>
|
||||
#include <LibGUI/Application.h>
|
||||
#include <LibGUI/BoxLayout.h>
|
||||
|
@ -14,34 +15,21 @@
|
|||
#include <LibGUI/Menu.h>
|
||||
#include <LibGUI/Menubar.h>
|
||||
#include <LibGUI/Window.h>
|
||||
#include <LibMain/Main.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) {
|
||||
perror("pledge");
|
||||
return 1;
|
||||
}
|
||||
TRY(Core::System::pledge("stdio rpath recvfd sendfd unix", nullptr));
|
||||
|
||||
auto app = GUI::Application::construct(argc, argv);
|
||||
auto app = GUI::Application::construct(arguments);
|
||||
|
||||
Config::pledge_domains("Snake");
|
||||
|
||||
if (pledge("stdio rpath recvfd sendfd", nullptr) < 0) {
|
||||
perror("pledge");
|
||||
return 1;
|
||||
}
|
||||
TRY(Core::System::pledge("stdio rpath recvfd sendfd", nullptr));
|
||||
|
||||
if (unveil("/res", "r") < 0) {
|
||||
perror("unveil");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (unveil(nullptr, nullptr) < 0) {
|
||||
perror("unveil");
|
||||
return 1;
|
||||
}
|
||||
TRY(Core::System::unveil("/res", "r"));
|
||||
TRY(Core::System::unveil(nullptr, nullptr));
|
||||
|
||||
auto app_icon = GUI::Icon::default_icon("app-snake");
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue