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/ftnoir_protocol_wine.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'proto-wine/ftnoir_protocol_wine.cpp') diff --git a/proto-wine/ftnoir_protocol_wine.cpp b/proto-wine/ftnoir_protocol_wine.cpp index c44cfc43b..b70b3f163 100644 --- a/proto-wine/ftnoir_protocol_wine.cpp +++ b/proto-wine/ftnoir_protocol_wine.cpp @@ -87,11 +87,13 @@ module_status wine::initialize() if (s.proton_appid == 0) return error(tr("Must specify application id for Proton (Steam Play)")); - std::tuple make_steam_environ(const QString& proton_path, int appid); - QString proton_path(const QString& proton_path); + std::tuple make_steam_environ(const QString& proton_dist_path, int appid); + QString proton_path(const QString& proton_dist_path); - wine_path = proton_path(s.proton_path().toString()); - auto [proton_env, error_string, success] = make_steam_environ(s.proton_path().toString(), s.proton_appid); + QString proton_dist_path = s.proton_path().toString(); + + wine_path = proton_path(proton_dist_path); + auto [proton_env, error_string, success] = make_steam_environ(proton_dist_path, s.proton_appid); env = proton_env; if (!success) -- cgit v1.2.3