From d1372122228076e68ae206cad64b8d1e236a0dd7 Mon Sep 17 00:00:00 2001 From: Tony Wasserka Date: Tue, 17 Jun 2025 11:28:07 +0200 Subject: [PATCH] FEXGetConfig: Infer install prefix from executable path --- Source/Tools/FEXGetConfig/Main.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Source/Tools/FEXGetConfig/Main.cpp b/Source/Tools/FEXGetConfig/Main.cpp index 373c03225..e8c5f01b8 100644 --- a/Source/Tools/FEXGetConfig/Main.cpp +++ b/Source/Tools/FEXGetConfig/Main.cpp @@ -1,5 +1,4 @@ // SPDX-License-Identifier: MIT -#include "ConfigDefines.h" #include "Common/cpp-optparse/OptionParser.h" #include "Common/Config.h" #include "Common/FEXServerClient.h" @@ -155,7 +154,13 @@ int main(int argc, char** argv, char** envp) { } if (Options.is_set_by_user("install_prefix")) { - fprintf(stdout, FEX_INSTALL_PREFIX "\n"); + char SelfPath[PATH_MAX]; + auto Result = readlink("/proc/self/exe", SelfPath, PATH_MAX); + if (Result == -1) { + Result = 0; + } + auto InstallPrefix = std::filesystem::path(&SelfPath[0], &SelfPath[Result]).parent_path().parent_path().string(); + fprintf(stdout, "%s\n", InstallPrefix.c_str()); } if (Options.is_set_by_user("current_rootfs")) {