From 180953b399b8ae48ead049d17b73cab7a2717f17 Mon Sep 17 00:00:00 2001 From: Kiril Zvezdarov Date: Sat, 8 Jun 2024 16:54:50 -0400 Subject: Refactored proton_path to be the dist dir location From Proton 9.0 and up, the directory containing library files and wine executables - previously called `dist`, appears to have been renamed to `files`. This breaks OpenTrack with newer Proton versions, because the path to the `wine` executable and proton library files is constructed as `:PROTON_PATH/dist/bin/wine`, i.e. the dist dir name is hardcoded. To fix this while preserving backward compatibility, this commit changes `proton_path` to point to the `dist` dir directly, be it `files` for 9.0+ or `dist` for older versions. Templated variables are adjusted accordingly to omit the dist dir. Obtaining the dist. dir path for a specific Proton version is done by recursively iterating the version's directory, looking for the `wine` executable. The first match is used to discover the grandparent dir path, which is the desired `:PROTON_PATH/:DIST_DIR` path. --- proto-wine/proton.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'proto-wine/proton.cpp') diff --git a/proto-wine/proton.cpp b/proto-wine/proton.cpp index 5ecd1f93..973206a5 100644 --- a/proto-wine/proton.cpp +++ b/proto-wine/proton.cpp @@ -25,7 +25,7 @@ static const char* runtime_paths[] = { }; -std::tuple make_steam_environ(const QString& proton_path, int appid) +std::tuple make_steam_environ(const QString& proton_dist_path, int appid) { using ret = std::tuple; auto env = QProcessEnvironment::systemEnvironment(); @@ -35,7 +35,7 @@ std::tuple make_steam_environ(const QString& auto expand = [&](QString x) { x.replace("HOME", home); - x.replace("PROTON_PATH", proton_path); + x.replace("PROTON_DIST_PATH", proton_dist_path); x.replace("RUNTIME_PATH", runtime_path); return x; }; @@ -58,14 +58,15 @@ std::tuple make_steam_environ(const QString& error = QString("Couldn't find a Wineprefix for AppId %1").arg(appid); QString path = expand( - ":PROTON_PATH/dist/bin" + ":PROTON_DIST_PATH/bin" + ":PROTON_DIST_PATH/bin" ); path += ':'; path += qgetenv("PATH"); env.insert("PATH", path); QString library_path = expand( - ":PROTON_PATH/dist/lib" - ":PROTON_PATH/dist/lib64" + ":PROTON_DIST_PATH/lib" + ":PROTON_DIST_PATH/lib64" ":RUNTIME_PATH/pinned_libs_32" ":RUNTIME_PATH/pinned_libs_64" ":RUNTIME_PATH/i386/lib/i386-linux-gnu" @@ -84,9 +85,9 @@ std::tuple make_steam_environ(const QString& return ret(env, error, error.isEmpty()); } -QString proton_path(const QString& proton_path) + +QString proton_path(const QString& proton_dist_path) { - return proton_path + "/dist/bin/wine"; + return proton_dist_path + "/bin/wine"; } - #endif -- cgit v1.2.3 From 9fcb6b524b7c9d6937f88a4b9928a905d886df1d Mon Sep 17 00:00:00 2001 From: Kiril Zvezdarov Date: Sat, 8 Jun 2024 18:41:40 -0400 Subject: Fixed copy-pasta leftovers --- proto-wine/proton.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'proto-wine/proton.cpp') diff --git a/proto-wine/proton.cpp b/proto-wine/proton.cpp index 973206a5..868a4004 100644 --- a/proto-wine/proton.cpp +++ b/proto-wine/proton.cpp @@ -59,7 +59,6 @@ std::tuple make_steam_environ(const QString& QString path = expand( ":PROTON_DIST_PATH/bin" - ":PROTON_DIST_PATH/bin" ); path += ':'; path += qgetenv("PATH"); env.insert("PATH", path); -- cgit v1.2.3