diff --git a/CMakeLists.txt b/CMakeLists.txt index 78407c2..0873831 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,6 +6,8 @@ cmake_minimum_required(VERSION 3.0.0) endif() #endif() +set (CMAKE_CXX_STANDARD 20) + # If the toolchain is already defined, do not attempt to find it if(NOT DEFINED CMAKE_TOOLCHAIN_FILE) # If the VCPKG_ROOT environment variable is not defined, try to automatically define it from AppData/home diff --git a/src/bridge/bridge-unix-sockets.cpp b/src/bridge/bridge-unix-sockets.cpp index fcd55fc..e53e721 100644 --- a/src/bridge/bridge-unix-sockets.cpp +++ b/src/bridge/bridge-unix-sockets.cpp @@ -29,9 +29,13 @@ #include "unix-sockets.hpp" #include #include +#include +#include -#define SOCKET_PATH "/tmp/SlimeVRDriver" +#define TMP_DIR "/tmp" +#define SOCKET_NAME "SlimeVRDriver" +namespace fs = std::filesystem; namespace { inline constexpr int HEADER_SIZE = 4; @@ -152,7 +156,13 @@ bool sendBridgeMessage(messages::ProtobufMessage& message, SlimeVRDriver::VRDriv BridgeStatus runBridgeFrame(SlimeVRDriver::VRDriver& driver) { try { if (!client.IsOpen()) { - client.Open(SOCKET_PATH); + // TODO: do this once in the constructor or something + if(const char* ptr = std::getenv("XDG_RUNTIME_DIR")) { + const fs::path xdg_runtime = ptr; + client.Open((xdg_runtime / SOCKET_NAME).native()); + } else { + client.Open((fs::path(TMP_DIR) / SOCKET_NAME).native()); + } } client.UpdateOnce();