Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check flatpak runtime dir first on Linux #48

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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/bridge-unix-sockets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#define TMP_DIR "/tmp"
#define XDG_DATA_DIR_DEFAULT ".local/share"
#define SLIMEVR_DATA_DIR "slimevr"
#define SLIMEVR_FLATPAK_RUNTIME_DIR "app/dev.slimevr.SlimeVR"
#define SOCKET_NAME "SlimeVRDriver"

namespace fs = std::filesystem;
Expand Down Expand Up @@ -162,7 +163,11 @@ BridgeStatus runBridgeFrame(SlimeVRDriver::VRDriver& driver) {
// 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