diff options
author | Lenny Maiorani <lenny@serenityos.org> | 2022-02-09 12:57:36 -0700 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-02-09 21:01:52 +0000 |
commit | f0d2489254490517d8a42367ae420254422d484e (patch) | |
tree | 301488841c52304632ef4b70045fe5a6400b8ce5 /Userland/Applications/Assistant | |
parent | 133a30c8b728d00fcd1c9969a2f8e556432074f6 (diff) | |
download | serenity-f0d2489254490517d8a42367ae420254422d484e.zip |
Applications: Port Assistant to LibMain
Diffstat (limited to 'Userland/Applications/Assistant')
-rw-r--r-- | Userland/Applications/Assistant/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Userland/Applications/Assistant/main.cpp | 14 |
2 files changed, 9 insertions, 7 deletions
diff --git a/Userland/Applications/Assistant/CMakeLists.txt b/Userland/Applications/Assistant/CMakeLists.txt index 3f0e6c7cdd..1112ff5eeb 100644 --- a/Userland/Applications/Assistant/CMakeLists.txt +++ b/Userland/Applications/Assistant/CMakeLists.txt @@ -11,5 +11,5 @@ set(SOURCES ) serenity_app(Assistant ICON app-run) -target_link_libraries(Assistant LibCore LibDesktop LibGUI LibJS LibThreading) +target_link_libraries(Assistant LibCore LibDesktop LibGUI LibJS LibMain LibThreading) link_with_unicode_data(Assistant) diff --git a/Userland/Applications/Assistant/main.cpp b/Userland/Applications/Assistant/main.cpp index f58df60e4d..2d304830eb 100644 --- a/Userland/Applications/Assistant/main.cpp +++ b/Userland/Applications/Assistant/main.cpp @@ -1,13 +1,17 @@ /* * Copyright (c) 2021, Spencer Dixon <spencercdixon@gmail.com> + * Copyright (c) 2022, the SerenityOS developers. * * SPDX-License-Identifier: BSD-2-Clause */ #include "Providers.h" +#include <AK/Error.h> #include <AK/QuickSort.h> #include <AK/String.h> +#include <AK/Try.h> #include <LibCore/LockFile.h> +#include <LibCore/System.h> #include <LibGUI/Application.h> #include <LibGUI/BoxLayout.h> #include <LibGUI/Event.h> @@ -17,6 +21,7 @@ #include <LibGUI/Painter.h> #include <LibGUI/TextBox.h> #include <LibGfx/Palette.h> +#include <LibMain/Main.h> #include <LibThreading/Mutex.h> #include <string.h> #include <unistd.h> @@ -186,12 +191,9 @@ private: static constexpr size_t MAX_SEARCH_RESULTS = 6; -int main(int argc, char** argv) +ErrorOr<int> serenity_main(Main::Arguments arguments) { - if (pledge("stdio recvfd sendfd rpath cpath unix proc exec thread", nullptr) < 0) { - perror("pledge"); - return 1; - } + TRY(Core::System::pledge("stdio recvfd sendfd rpath cpath unix proc exec thread", nullptr)); Core::LockFile lockfile("/tmp/lock/assistant.lock"); @@ -205,7 +207,7 @@ int main(int argc, char** argv) return 0; } - auto app = GUI::Application::construct(argc, argv); + auto app = GUI::Application::construct(arguments); auto window = GUI::Window::construct(); window->set_minimizable(false); |