From b7d3b242fd26f68b6d215a75c68a96dba4360110 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Tue, 26 Apr 2022 21:26:25 +0200 Subject: [PATCH] (Linux) Ugly Flatpak PATH hack. --- es-core/src/utils/FileSystemUtil.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/es-core/src/utils/FileSystemUtil.cpp b/es-core/src/utils/FileSystemUtil.cpp index 095773a52..9147a1c52 100644 --- a/es-core/src/utils/FileSystemUtil.cpp +++ b/es-core/src/utils/FileSystemUtil.cpp @@ -255,9 +255,19 @@ namespace Utils #if defined(_WIN64) return ""; #else - std::string pathVariable = std::string(getenv("PATH")); - std::vector pathList = - Utils::String::delimitedStringToVector(pathVariable, ":"); +#if defined(FLATPAK_BUILD) + // Ugly hack for the Flatpak build as Flathub doesn't allow the "--env=PATH=" option + // to be used and I have not found a way to pass the actual PATH variable from the host + // to the sandbox. This variable value is a combination of all common paths found on + // all supported distributions. + std::string pathVariable {"/app/bin:/var/lib/flatpak/exports/bin:/usr/bin:/usr/local/" + "bin:/usr/local/sbin:/usr/sbin:/sbin:/bin:/usr/games:/usr/" + "local/games:/snap/bin:/var/lib/snapd/snap/bin"}; +#else + std::string pathVariable {std::string(getenv("PATH"))}; +#endif + std::vector pathList { + Utils::String::delimitedStringToVector(pathVariable, ":")}; std::string pathTest;