summaryrefslogtreecommitdiffhomepage
path: root/proto-wine/ftnoir_protocol_wine.cpp
diff options
context:
space:
mode:
authorKiril Zvezdarov <kzvezdarov@gmail.com>2024-06-08 16:54:50 -0400
committerKiril Zvezdarov <kzvezdarov@gmail.com>2024-06-08 17:56:36 -0400
commit180953b399b8ae48ead049d17b73cab7a2717f17 (patch)
treeb515d4aadd800661ca4adc8dbbfe43929e727c5d /proto-wine/ftnoir_protocol_wine.cpp
parent788d478be6c363d151a9693b3b1d4e4eaa11c021 (diff)
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.
Diffstat (limited to 'proto-wine/ftnoir_protocol_wine.cpp')
-rw-r--r--proto-wine/ftnoir_protocol_wine.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/proto-wine/ftnoir_protocol_wine.cpp b/proto-wine/ftnoir_protocol_wine.cpp
index c44cfc43..b70b3f16 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<QProcessEnvironment, QString, bool> make_steam_environ(const QString& proton_path, int appid);
- QString proton_path(const QString& proton_path);
+ std::tuple<QProcessEnvironment, QString, bool> 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)