Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/bridge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ class UnixSocketBridge final : public SlimeVRBridge {
static constexpr std::string_view TMP_DIR = "/tmp";
static constexpr std::string_view XDG_DATA_DIR_DEFAULT = ".local/share";
static constexpr std::string_view SLIMEVR_DATA_DIR = "slimevr";
static constexpr std::string_view SLIMEVR_FLATPAK_RUNTIME_DIR = "app/dev.slimevr.SlimeVR";
static constexpr std::string_view SOCKET_NAME = "SlimeVRInput";
inline static constexpr int HEADER_SIZE = 4;
inline static constexpr int BUFFER_SIZE = 1024;
Expand Down Expand Up @@ -146,7 +147,11 @@ class UnixSocketBridge final : public SlimeVRBridge {
// TODO: do this once in the constructor or something
if(const char* ptr = std::getenv("XDG_RUNTIME_DIR")) {
const fs::path xdg_runtime = ptr;
socket = (xdg_runtime / SOCKET_NAME);
// check flatpak dir first, then root runtime dir
socket = (xdg_runtime / SLIMEVR_FLATPAK_RUNTIME_DIR / SOCKET_NAME);
if(!fs::exists(socket)) {
socket = (xdg_runtime / SOCKET_NAME);
}
}
if(!fs::exists(socket)) {
socket = (fs::path(TMP_DIR) / SOCKET_NAME);
Expand Down