diff options
author | Andreas Kling <kling@serenityos.org> | 2021-11-23 16:08:52 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-11-24 00:25:22 +0100 |
commit | db79f1cb784eb064020b0a1a57b2bc021f345f75 (patch) | |
tree | f933bd2ba74db77edbbeda45c8111b0cef520acf /Userland/Applications/Welcome | |
parent | ca23644397025f041370a14e50928f186c2ff721 (diff) | |
download | serenity-db79f1cb784eb064020b0a1a57b2bc021f345f75.zip |
Welcome: Port to LibMain :^)
Diffstat (limited to 'Userland/Applications/Welcome')
-rw-r--r-- | Userland/Applications/Welcome/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Userland/Applications/Welcome/main.cpp | 44 |
2 files changed, 12 insertions, 34 deletions
diff --git a/Userland/Applications/Welcome/CMakeLists.txt b/Userland/Applications/Welcome/CMakeLists.txt index 2b3b8e940a..14172ed1d4 100644 --- a/Userland/Applications/Welcome/CMakeLists.txt +++ b/Userland/Applications/Welcome/CMakeLists.txt @@ -13,4 +13,4 @@ set(SOURCES ) serenity_app(Welcome ICON app-welcome) -target_link_libraries(Welcome LibGUI LibWeb) +target_link_libraries(Welcome LibGUI LibWeb LibMain) diff --git a/Userland/Applications/Welcome/main.cpp b/Userland/Applications/Welcome/main.cpp index 86419ff85c..c76c2a67e3 100644 --- a/Userland/Applications/Welcome/main.cpp +++ b/Userland/Applications/Welcome/main.cpp @@ -6,50 +6,28 @@ #include "WelcomeWidget.h" #include <LibConfig/Client.h> +#include <LibCore/System.h> #include <LibGUI/Application.h> #include <LibGUI/Icon.h> #include <LibGUI/Window.h> +#include <LibMain/Main.h> #include <unistd.h> -int main(int argc, char** argv) +ErrorOr<int> serenity_main(Main::Arguments arguments) { - if (pledge("stdio recvfd sendfd rpath unix proc exec", nullptr) < 0) { - perror("pledge"); - return 1; - } - - auto app = GUI::Application::construct(argc, argv); + TRY(Core::System::pledge("stdio recvfd sendfd rpath unix proc exec", nullptr)); + auto app = TRY(GUI::Application::try_create(arguments)); Config::pledge_domains("SystemServer"); - if (unveil("/res", "r") < 0) { - perror("unveil"); - return 1; - } - - if (unveil("/home", "r") < 0) { - perror("unveil"); - return 1; - } - - if (unveil("/tmp/portal/webcontent", "rw") < 0) { - perror("unveil"); - return 1; - } - - if (unveil("/bin/Help", "x") < 0) { - perror("unveil"); - return 1; - } - - if (unveil(nullptr, nullptr) < 0) { - perror("unveil"); - return 1; - } - + TRY(Core::System::unveil("/res", "r")); + TRY(Core::System::unveil("/home", "r")); + TRY(Core::System::unveil("/tmp/portal/webcontent", "rw")); + TRY(Core::System::unveil("/bin/Help", "x")); + TRY(Core::System::unveil(nullptr, nullptr)); auto app_icon = GUI::Icon::default_icon("app-welcome"); - auto window = GUI::Window::construct(); + auto window = TRY(GUI::Window::try_create()); window->resize(480, 250); window->center_on_screen(); |