diff --git a/server/main.cpp b/server/main.cpp index 5e288683..1353f95c 100644 --- a/server/main.cpp +++ b/server/main.cpp @@ -56,7 +56,6 @@ static std::unique_ptr listener; std::optional> wivrn_ipc_socket_main_loop; std::optional> wivrn_ipc_socket_monado; -#ifdef WIVRN_USE_SYSTEMD std::filesystem::path socket_path() { char sock_file[PATH_MAX]; @@ -65,14 +64,13 @@ std::filesystem::path socket_path() return {sock_file, sock_file + size}; } +#ifdef WIVRN_USE_SYSTEMD int create_listen_socket() { sockaddr_un addr{}; 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()); @@ -599,6 +597,8 @@ int inner_main(int argc, char * argv[], bool show_instructions) std::cerr << "For Steam games, set command to " << steam_command() << std::endl; } + std::filesystem::create_directories(socket_path().parent_path()); + #ifdef WIVRN_USE_SYSTEMD create_listen_socket(); #else