Skip to content

Commit

Permalink
HackStudio: Port to LibMain :^)
Browse files Browse the repository at this point in the history
  • Loading branch information
guerinoni authored and bgianfo committed Nov 26, 2021
1 parent 98e65f7 commit 4a90729
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Userland/DevTools/HackStudio/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
13 changes: 6 additions & 7 deletions Userland/DevTools/HackStudio/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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();
Expand All @@ -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);

Expand Down

0 comments on commit 4a90729

Please sign in to comment.