diff --git a/Userland/Applications/FontEditor/CMakeLists.txt b/Userland/Applications/FontEditor/CMakeLists.txt index 37422c4a81..2b4d8313d9 100644 --- a/Userland/Applications/FontEditor/CMakeLists.txt +++ b/Userland/Applications/FontEditor/CMakeLists.txt @@ -22,4 +22,4 @@ set(SOURCES ) serenity_app(FontEditor ICON app-font-editor) -target_link_libraries(FontEditor LibGUI LibDesktop LibGfx) +target_link_libraries(FontEditor LibGUI LibDesktop LibGfx LibMain) diff --git a/Userland/Applications/FontEditor/main.cpp b/Userland/Applications/FontEditor/main.cpp index cca06c4ed7..b9c6e9c413 100644 --- a/Userland/Applications/FontEditor/main.cpp +++ b/Userland/Applications/FontEditor/main.cpp @@ -7,6 +7,7 @@ #include "FontEditor.h" #include #include +#include #include #include #include @@ -15,22 +16,13 @@ #include #include #include -#include -#include +#include -int main(int argc, char** argv) +ErrorOr serenity_main(Main::Arguments arguments) { - if (pledge("stdio recvfd sendfd thread rpath unix cpath wpath", nullptr) < 0) { - perror("pledge"); - return 1; - } + TRY(Core::System::pledge("stdio recvfd sendfd thread rpath unix cpath wpath", nullptr)); - auto app = GUI::Application::construct(argc, argv); - - if (pledge("stdio recvfd sendfd thread rpath unix cpath wpath", nullptr) < 0) { - perror("pledge"); - return 1; - } + auto app = TRY(GUI::Application::try_create(arguments)); if (!Desktop::Launcher::add_allowed_handler_with_only_specific_urls( "/bin/Help", @@ -40,15 +32,12 @@ int main(int argc, char** argv) return 1; } - if (pledge("stdio recvfd sendfd thread rpath cpath wpath", nullptr) < 0) { - perror("pledge"); - return 1; - } + TRY(Core::System::pledge("stdio recvfd sendfd thread rpath cpath wpath", nullptr)); const char* path = nullptr; Core::ArgsParser args_parser; args_parser.add_positional_argument(path, "The font file for editing.", "file", Core::ArgsParser::Required::No); - args_parser.parse(argc, argv); + args_parser.parse(arguments); RefPtr edited_font; if (path == nullptr) { @@ -71,7 +60,7 @@ int main(int argc, char** argv) auto app_icon = GUI::Icon::default_icon("app-font-editor"); - auto window = GUI::Window::construct(); + auto window = TRY(GUI::Window::try_create()); window->set_icon(app_icon.bitmap_for_size(16)); window->resize(440, 470);