mirror of
https://github.com/RGBCube/serenity
synced 2025-05-25 14:05:07 +00:00

This is an encapsulation of the common work done by all of our single-client IPC servers on startup: 1. Create a Core::LocalSocket, taking over an accepted fd. 2. Create an application-specific ClientConnection object, wrapping the socket. It's not a huge change in terms of lines saved, but I do feel that it improves expressiveness. :^)
22 lines
662 B
C++
22 lines
662 B
C++
/*
|
|
* Copyright (c) 2021, timmot <tiwwot@protonmail.com>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <FileSystemAccessServer/ClientConnection.h>
|
|
#include <LibCore/System.h>
|
|
#include <LibGUI/Application.h>
|
|
#include <LibIPC/SingleServer.h>
|
|
#include <LibMain/Main.h>
|
|
|
|
ErrorOr<int> serenity_main(Main::Arguments)
|
|
{
|
|
TRY(Core::System::pledge("stdio recvfd sendfd rpath cpath wpath unix thread"));
|
|
|
|
auto app = GUI::Application::construct(0, nullptr);
|
|
app->set_quit_when_last_window_deleted(false);
|
|
|
|
auto client = TRY(IPC::take_over_accepted_client_from_system_server<FileSystemAccessServer::ClientConnection>());
|
|
return app->exec();
|
|
}
|