Change the default socket location, create the parent directory

This commit is contained in:
Guillaume Meunier
2024-09-27 19:25:57 +02:00
parent 9774d8c1d1
commit b6a09ea11a
2 changed files with 5 additions and 3 deletions
+4 -2
View File
@@ -57,12 +57,12 @@ std::optional<xrt::drivers::wivrn::typed_socket<xrt::drivers::wivrn::UnixDatagra
std::optional<xrt::drivers::wivrn::typed_socket<xrt::drivers::wivrn::UnixDatagram, to_monado::packets, from_monado::packets>> wivrn_ipc_socket_monado;
#ifdef WIVRN_USE_SYSTEMD
std::string socket_path()
std::filesystem::path socket_path()
{
char sock_file[PATH_MAX];
size_t size = u_file_get_path_in_runtime_dir(XRT_IPC_MSG_SOCK_FILENAME, sock_file, PATH_MAX);
return {sock_file, size};
return {sock_file, sock_file + size};
}
int create_listen_socket()
@@ -71,6 +71,8 @@ int create_listen_socket()
auto sock_file = socket_path();
std::filesystem::create_directories(sock_file.parent_path());
addr.sun_family = AF_UNIX;
strcpy(addr.sun_path, sock_file.c_str());