diff --git a/Userland/Applications/PixelPaint/CMakeLists.txt b/Userland/Applications/PixelPaint/CMakeLists.txt index 84252f41abc..8ce2b6851c5 100644 --- a/Userland/Applications/PixelPaint/CMakeLists.txt +++ b/Userland/Applications/PixelPaint/CMakeLists.txt @@ -45,4 +45,4 @@ set(SOURCES ) serenity_app(PixelPaint ICON app-pixel-paint) -target_link_libraries(PixelPaint LibImageDecoderClient LibGUI LibGfx LibFileSystemAccessClient LibConfig) +target_link_libraries(PixelPaint LibImageDecoderClient LibGUI LibGfx LibFileSystemAccessClient LibConfig LibMain) diff --git a/Userland/Applications/PixelPaint/main.cpp b/Userland/Applications/PixelPaint/main.cpp index 5d9fa0bf037..dcd67edc71d 100644 --- a/Userland/Applications/PixelPaint/main.cpp +++ b/Userland/Applications/PixelPaint/main.cpp @@ -8,7 +8,6 @@ #include "MainWidget.h" #include #include -#include #include #include #include @@ -17,48 +16,26 @@ #include #include #include -#include -#include +#include +#include -int main(int argc, char** argv) +ErrorOr serenity_main(Main::Arguments arguments) { - if (pledge("stdio thread recvfd sendfd rpath unix wpath cpath", nullptr) < 0) { - perror("pledge"); - return 1; - } + TRY(System::pledge("stdio thread recvfd sendfd rpath unix wpath cpath", nullptr)); - auto app = GUI::Application::construct(argc, argv); + auto app = GUI::Application::construct(arguments.argc, arguments.argv); Config::pledge_domains("PixelPaint"); const char* image_file = nullptr; Core::ArgsParser args_parser; args_parser.add_positional_argument(image_file, "Image file to open", "path", Core::ArgsParser::Required::No); - args_parser.parse(argc, argv); + args_parser.parse(arguments.argc, arguments.argv); - if (unveil("/res", "r") < 0) { - perror("unveil"); - return 1; - } - - if (unveil("/tmp/portal/clipboard", "rw") < 0) { - perror("unveil"); - return 1; - } - - if (unveil("/tmp/portal/filesystemaccess", "rw") < 0) { - perror("unveil"); - return 1; - } - - if (unveil("/tmp/portal/image", "rw") < 0) { - perror("unveil"); - return 1; - } - - if (unveil(nullptr, nullptr) < 0) { - perror("unveil"); - return 1; - } + TRY(System::unveil("/res", "r")); + TRY(System::unveil("/tmp/portal/clipboard", "rw")); + TRY(System::unveil("/tmp/portal/filesystemaccess", "rw")); + TRY(System::unveil("/tmp/portal/image", "rw")); + TRY(System::unveil(nullptr, nullptr)); auto app_icon = GUI::Icon::default_icon("app-pixel-paint");