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:
parent
55dbd19a16
commit
7d2170246f
2 changed files with 8 additions and 17 deletions
|
@ -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)
|
||||
|
|
|
@ -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");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue