HackStudio: Show notification if 'make' is not available

We previously popped a MessageBox for this, but a notification is less
disruptive.
This commit is contained in:
Itamar 2021-02-10 20:02:43 +02:00 committed by Andreas Kling
parent 653c3d5812
commit e42b9e879c
Notes: sideshowbarker 2024-07-18 22:26:27 +09:00

View File

@ -35,6 +35,7 @@
#include <LibGUI/Application.h>
#include <LibGUI/MenuBar.h>
#include <LibGUI/MessageBox.h>
#include <LibGUI/Notification.h>
#include <LibGUI/Widget.h>
#include <LibGUI/Window.h>
#include <LibThread/Lock.h>
@ -53,6 +54,7 @@ static RefPtr<GUI::Window> s_window;
static RefPtr<HackStudioWidget> s_hack_studio_widget;
static bool make_is_available();
static void notify_make_not_available();
static void update_path_environment_variable();
int main(int argc, char** argv)
@ -75,8 +77,9 @@ int main(int argc, char** argv)
update_path_environment_variable();
if (!make_is_available())
GUI::MessageBox::show(s_window, "The 'make' command is not available. You probably want to install the binutils, gcc, and make ports from the root of the Serenity repository.", "Error", GUI::MessageBox::Type::Error);
if (!make_is_available()) {
notify_make_not_available();
}
const char* path_argument = nullptr;
Core::ArgsParser args_parser;
@ -122,6 +125,14 @@ static bool make_is_available()
return WEXITSTATUS(wstatus) == 0;
}
static void notify_make_not_available()
{
auto notification = GUI::Notification::construct();
notification->set_title("'make' Not Available");
notification->set_text("You probably want to install the binutils, gcc, and make ports from the root of the Serenity repository");
notification->show();
}
static void update_path_environment_variable()
{
StringBuilder path;