mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 17:40:27 +00:00
Spider: Port to LibMain
Simplified two pledge() and two unveil() by using TRY()
This commit is contained in:
parent
85ae298b85
commit
71298ad9ba
Notes:
sideshowbarker
2024-07-18 00:50:27 +09:00
Author: https://github.com/pbrw 🔰 Commit: https://github.com/SerenityOS/serenity/commit/71298ad9baf Pull-request: https://github.com/SerenityOS/serenity/pull/11025
2 changed files with 9 additions and 21 deletions
|
@ -13,4 +13,4 @@ set(SOURCES
|
|||
)
|
||||
|
||||
serenity_app(Spider ICON app-spider)
|
||||
target_link_libraries(Spider LibCards LibGUI LibGfx LibCore LibConfig)
|
||||
target_link_libraries(Spider LibCards LibGUI LibGfx LibCore LibConfig LibMain)
|
||||
|
|
|
@ -18,8 +18,9 @@
|
|||
#include <LibGUI/MessageBox.h>
|
||||
#include <LibGUI/Statusbar.h>
|
||||
#include <LibGUI/Window.h>
|
||||
#include <LibMain/Main.h>
|
||||
#include <LibSystem/Wrappers.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
enum class StatisticDisplay : u8 {
|
||||
HighScore,
|
||||
|
@ -36,32 +37,19 @@ static String format_seconds(uint64_t seconds_elapsed)
|
|||
return String::formatted("{:02}:{:02}:{:02}", hours, minutes, seconds);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
{
|
||||
if (pledge("stdio recvfd sendfd rpath unix", nullptr) < 0) {
|
||||
perror("pledge");
|
||||
return 1;
|
||||
}
|
||||
TRY(System::pledge("stdio recvfd sendfd rpath unix", nullptr));
|
||||
|
||||
auto app = GUI::Application::construct(argc, argv);
|
||||
auto app = GUI::Application::construct(arguments.argc, arguments.argv);
|
||||
auto app_icon = GUI::Icon::default_icon("app-spider");
|
||||
|
||||
Config::pledge_domains("Spider");
|
||||
|
||||
if (pledge("stdio recvfd sendfd rpath", nullptr) < 0) {
|
||||
perror("pledge");
|
||||
return 1;
|
||||
}
|
||||
TRY(System::pledge("stdio recvfd sendfd rpath", nullptr));
|
||||
|
||||
if (unveil("/res", "r") < 0) {
|
||||
perror("unveil");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (unveil(nullptr, nullptr) < 0) {
|
||||
perror("unveil");
|
||||
return 1;
|
||||
}
|
||||
TRY(System::unveil("/res", "r"));
|
||||
TRY(System::unveil(nullptr, nullptr));
|
||||
|
||||
auto window = GUI::Window::construct();
|
||||
window->set_title("Spider");
|
||||
|
|
Loading…
Reference in a new issue