diff options
author | RasmusNylander <43042651+rasmusnylander@users.noreply.github.com> | 2021-12-16 14:20:25 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-01-06 17:54:03 +0100 |
commit | 017135b44e91b0d9527e8f56212647c49a6faaf7 (patch) | |
tree | c374fe69a67ec0fac59e283fc6d63a196427dc6c /Userland | |
parent | 64684cbd5dd242d62c912563b667ec6f890b6fae (diff) | |
download | serenity-017135b44e91b0d9527e8f56212647c49a6faaf7.zip |
KeyboardMapper: Port to LibMain
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Applications/KeyboardMapper/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Userland/Applications/KeyboardMapper/main.cpp | 24 |
2 files changed, 9 insertions, 17 deletions
diff --git a/Userland/Applications/KeyboardMapper/CMakeLists.txt b/Userland/Applications/KeyboardMapper/CMakeLists.txt index 79b69ef815..d85a7d8dbe 100644 --- a/Userland/Applications/KeyboardMapper/CMakeLists.txt +++ b/Userland/Applications/KeyboardMapper/CMakeLists.txt @@ -11,4 +11,4 @@ set(SOURCES ) serenity_app(KeyboardMapper ICON app-keyboard-mapper) -target_link_libraries(KeyboardMapper LibGUI LibKeyboard) +target_link_libraries(KeyboardMapper LibGUI LibKeyboard LibMain) diff --git a/Userland/Applications/KeyboardMapper/main.cpp b/Userland/Applications/KeyboardMapper/main.cpp index bd418542fd..ef8b59521b 100644 --- a/Userland/Applications/KeyboardMapper/main.cpp +++ b/Userland/Applications/KeyboardMapper/main.cpp @@ -6,32 +6,27 @@ #include "KeyboardMapperWidget.h" #include <LibCore/ArgsParser.h> +#include <LibCore/System.h> #include <LibGUI/Action.h> #include <LibGUI/Application.h> #include <LibGUI/FilePicker.h> #include <LibGUI/Icon.h> #include <LibGUI/Menu.h> #include <LibGUI/Menubar.h> -#include <unistd.h> +#include <LibMain/Main.h> -int main(int argc, char** argv) +ErrorOr<int> serenity_main(Main::Arguments arguments) { const char* path = nullptr; Core::ArgsParser args_parser; args_parser.add_positional_argument(path, "Keyboard character mapping file.", "file", Core::ArgsParser::Required::No); - args_parser.parse(argc, argv); + args_parser.parse(arguments); - if (pledge("stdio getkeymap thread rpath cpath wpath recvfd sendfd unix", nullptr) < 0) { - perror("pledge"); - return 1; - } + TRY(Core::System::pledge("stdio getkeymap thread rpath cpath wpath recvfd sendfd unix")); - auto app = GUI::Application::construct(argc, argv); + auto app = GUI::Application::construct(arguments.argc, arguments.argv); - if (pledge("stdio getkeymap thread rpath cpath wpath recvfd sendfd", nullptr) < 0) { - perror("pledge"); - return 1; - } + TRY(Core::System::pledge("stdio getkeymap thread rpath cpath wpath recvfd sendfd")); auto app_icon = GUI::Icon::default_icon("app-keyboard-mapper"); @@ -49,10 +44,7 @@ int main(int argc, char** argv) keyboard_mapper_widget->load_from_system(); } - if (pledge("stdio thread rpath cpath wpath recvfd sendfd", nullptr) < 0) { - perror("pledge"); - return 1; - } + TRY(Core::System::pledge("stdio thread rpath cpath wpath recvfd sendfd")); auto open_action = GUI::CommonActions::make_open_action( [&](auto&) { |