mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:07:45 +00:00
PixelPaint: Port to LibMain
This commit is contained in:
parent
55db1811c7
commit
bec7ffaf0a
2 changed files with 12 additions and 35 deletions
|
@ -8,7 +8,6 @@
|
|||
#include "MainWidget.h"
|
||||
#include <LibConfig/Client.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibFileSystemAccessClient/Client.h>
|
||||
#include <LibGUI/Action.h>
|
||||
#include <LibGUI/Application.h>
|
||||
|
@ -17,48 +16,26 @@
|
|||
#include <LibGUI/Statusbar.h>
|
||||
#include <LibGUI/Window.h>
|
||||
#include <LibGfx/Painter.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <LibMain/Main.h>
|
||||
#include <LibSystem/Wrappers.h>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
ErrorOr<int> 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");
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue