1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 07:18:11 +00:00

Hearts: Port to LibMain

Simplified one pledge() and two unveil() by using TRY().
This commit is contained in:
Pedro Pereira 2021-11-23 10:39:33 +00:00 committed by Andreas Kling
parent 55dbd19a16
commit 7d2170246f
2 changed files with 8 additions and 17 deletions

View file

@ -17,4 +17,4 @@ set(SOURCES
)
serenity_app(Hearts ICON app-hearts)
target_link_libraries(Hearts LibCards LibGUI LibGfx LibCore LibConfig)
target_link_libraries(Hearts LibCards LibGUI LibGfx LibCore LibConfig LibMain)

View file

@ -10,6 +10,7 @@
#include "SettingsDialog.h"
#include <Games/Hearts/HeartsGML.h>
#include <LibConfig/Client.h>
#include <LibCore/System.h>
#include <LibCore/Timer.h>
#include <LibGUI/Action.h>
#include <LibGUI/ActionGroup.h>
@ -20,30 +21,20 @@
#include <LibGUI/MessageBox.h>
#include <LibGUI/Statusbar.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)
{
auto app = GUI::Application::construct(argc, argv);
auto app = GUI::Application::construct(arguments);
auto app_icon = GUI::Icon::default_icon("app-hearts");
Config::pledge_domains("Hearts");
if (pledge("stdio recvfd sendfd rpath", nullptr) < 0) {
perror("pledge");
return 1;
}
TRY(Core::System::pledge("stdio recvfd sendfd rpath", 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 window = GUI::Window::construct();
window->set_title("Hearts");