summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorFederico Guerinoni <guerinoni.federico@gmail.com>2021-11-26 19:35:55 +0100
committerBrian Gianforcaro <b.gianfo@gmail.com>2021-11-26 11:13:59 -0800
commit4a90729a3ed542688d4d2ee554814b280f6da4ee (patch)
treee01fbd859ceeacd2b30fe40f9a15abc5b6c2b26b /Userland
parent98e65f71da8f525c0b3b29d0c2264090007e0d5c (diff)
downloadserenity-4a90729a3ed542688d4d2ee554814b280f6da4ee.zip
HackStudio: Port to LibMain :^)
Diffstat (limited to 'Userland')
-rw-r--r--Userland/DevTools/HackStudio/CMakeLists.txt2
-rw-r--r--Userland/DevTools/HackStudio/main.cpp13
2 files changed, 7 insertions, 8 deletions
diff --git a/Userland/DevTools/HackStudio/CMakeLists.txt b/Userland/DevTools/HackStudio/CMakeLists.txt
index 7308935417..8f6cc83d5e 100644
--- a/Userland/DevTools/HackStudio/CMakeLists.txt
+++ b/Userland/DevTools/HackStudio/CMakeLists.txt
@@ -50,5 +50,5 @@ set(SOURCES
)
serenity_app(HackStudio ICON app-hack-studio)
-target_link_libraries(HackStudio LibWeb LibMarkdown LibGUI LibCpp LibGfx LibCore LibVT LibDebug LibX86 LibDiff LibShell LibSymbolication LibRegex LibSQL LibCoredump)
+target_link_libraries(HackStudio LibWeb LibMarkdown LibGUI LibCpp LibGfx LibCore LibVT LibDebug LibX86 LibDiff LibShell LibSymbolication LibRegex LibSQL LibCoredump LibMain)
add_dependencies(HackStudio CppLanguageServer)
diff --git a/Userland/DevTools/HackStudio/main.cpp b/Userland/DevTools/HackStudio/main.cpp
index c8b093106b..0d65db23d3 100644
--- a/Userland/DevTools/HackStudio/main.cpp
+++ b/Userland/DevTools/HackStudio/main.cpp
@@ -12,10 +12,12 @@
#include <LibConfig/Client.h>
#include <LibCore/ArgsParser.h>
#include <LibCore/File.h>
+#include <LibCore/System.h>
#include <LibGUI/Application.h>
#include <LibGUI/Menubar.h>
#include <LibGUI/Notification.h>
#include <LibGUI/Window.h>
+#include <LibMain/Main.h>
#include <fcntl.h>
#include <spawn.h>
#include <stdio.h>
@@ -31,14 +33,11 @@ static bool make_is_available();
static void notify_make_not_available();
static void update_path_environment_variable();
-int main(int argc, char** argv)
+ErrorOr<int> serenity_main(Main::Arguments arguments)
{
- if (pledge("stdio recvfd sendfd tty rpath cpath wpath proc exec unix fattr thread ptrace", nullptr) < 0) {
- perror("pledge");
- return 1;
- }
+ TRY(Core::System::pledge("stdio recvfd sendfd tty rpath cpath wpath proc exec unix fattr thread ptrace", nullptr));
- auto app = GUI::Application::construct(argc, argv);
+ auto app = GUI::Application::construct(arguments.argc, arguments.argv);
Config::pledge_domains({ "HackStudio", "Terminal" });
auto window = GUI::Window::construct();
@@ -56,7 +55,7 @@ int main(int argc, char** argv)
Core::ArgsParser args_parser;
args_parser.add_positional_argument(path_argument, "Path to a workspace or a file", "path", Core::ArgsParser::Required::No);
args_parser.add_option(mode_coredump, "Inspect a coredump in HackStudio", "coredump", 'c');
- args_parser.parse(argc, argv);
+ args_parser.parse(arguments);
auto argument_absolute_path = Core::File::real_path_for(path_argument);