1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

api: C++17 include filesystem library by default

This commit is contained in:
Steffen Vogel 2018-12-02 03:58:10 +01:00
parent 5ca2a5046e
commit cb8c0e79f7

View file

@ -72,9 +72,8 @@ void Server::start()
struct sockaddr_un sun = { .sun_family = AF_UNIX };
#ifdef __GNU__
std::filesystem::path socketPath = PREFIX "/var/lib/villas";
if (!std::filesystem::exists(socketPath.parent_path())) {
if (!std::filesystem::exists(socketPath)) {
logging.get("api")->info("Creating directory for API socket: {}", socketPath);
std::filesystem::create_directories(socketPath);
}
@ -87,15 +86,6 @@ void Server::start()
}
strncpy(sun.sun_path, socketPath.c_str(), sizeof(sun.sun_path) - 1);
#else
std::string socketPath = fmt::format(PREFIX "/var/lib/villas/node-{}.sock", api->getSuperNode()->getName());
ret = unlink(socketPath.c_str());
if (ret && errno != ENOENT)
throw SystemError("Failed to unlink API socket");
strncpy(sun.sun_path, socketPath.c_str(), sizeof(sun.sun_path) - 1);
#endif
ret = bind(sd, (struct sockaddr *) &sun, sizeof(struct sockaddr_un));
if (ret)