FEXGetConfig: Infer install prefix from executable path

This commit is contained in:
Tony Wasserka committed 2025-06-17 11:40:32 +02:00
1 parent 9ad4e3a6a0
commit d137212222
1 file changed
+7 -2
+7 -2
View File
@@ -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")) {