From 0cab1027c360afa52c65860adba04b6b5811405f Mon Sep 17 00:00:00 2001 From: 0chroma <21014+0chroma@users.noreply.github.com> Date: Wed, 18 Sep 2024 07:47:57 -0700 Subject: [PATCH] check flatpak runtime dir first --- server/core/src/main/java/io/eiren/util/OperatingSystem.kt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/server/core/src/main/java/io/eiren/util/OperatingSystem.kt b/server/core/src/main/java/io/eiren/util/OperatingSystem.kt index 8a651e95e9..17b21299cf 100644 --- a/server/core/src/main/java/io/eiren/util/OperatingSystem.kt +++ b/server/core/src/main/java/io/eiren/util/OperatingSystem.kt @@ -39,6 +39,12 @@ enum class OperatingSystem( if (dir != null) return dir if (currentPlatform == LINUX) { dir = System.getenv("XDG_RUNTIME_DIR") + + // add /app/$FLATPAK_ID if running in flatpak + // see https://docs.flatpak.org/en/latest/sandbox-permissions.html + val flatpak_id = System.getenv("FLATPAK_ID") + if (flatpak_id != null) dir += "/app/" + flatpak_id + if (dir != null) return dir } return System.getProperty("java.io.tmpdir")