diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2024-10-02 21:53:58 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-02 21:53:58 +0000 |
commit | 8445296e453aad19781c955e612435c2da3e91cb (patch) | |
tree | 9c2ddc4a2a784d5fae9b87ee000d33ac4919a4a9 /proto-wine/proton.cpp | |
parent | 04bed1c5dd5bf658edff5cf18d9c5aef3f2af1d1 (diff) | |
parent | 4dd97af0f139f3ddc8f34a24ee961a1046015d3f (diff) |
Merge pull request #1932 from Priton-CE/wine-extended-proton
Diffstat (limited to 'proto-wine/proton.cpp')
-rw-r--r-- | proto-wine/proton.cpp | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/proto-wine/proton.cpp b/proto-wine/proton.cpp index aa2c3755..998da748 100644 --- a/proto-wine/proton.cpp +++ b/proto-wine/proton.cpp @@ -10,9 +10,9 @@ #include <QDebug> #include <QDir> #include <QFileInfo> -#include <QProcessEnvironment> #include <QtGlobal> +#include "proton.h" static const char* steam_paths[] = { "/.steam/steam/steamapps/compatdata", @@ -27,13 +27,13 @@ static const char* runtime_paths[] = { }; -std::tuple<QProcessEnvironment, QString, bool> make_steam_environ(const QString& proton_dist_path, int appid) +std::tuple<QProcessEnvironment, QString, bool> make_steam_environ(const QString& proton_dist_path) { using ret = std::tuple<QProcessEnvironment, QString, bool>; auto env = QProcessEnvironment::systemEnvironment(); QString error = ""; QString home = qgetenv("HOME"); - QString runtime_path, app_wineprefix; + QString runtime_path; auto expand = [&](QString x) { x.replace("HOME", home); @@ -51,14 +51,6 @@ std::tuple<QProcessEnvironment, QString, bool> make_steam_environ(const QString& if (runtime_path.isEmpty()) error = QString("Couldn't find a Steam runtime."); - for (const char* path : steam_paths) { - QDir dir(QDir::homePath() + path + expand("/%1/pfx").arg(appid)); - if (dir.exists()) - app_wineprefix = dir.absolutePath(); - } - if (app_wineprefix.isEmpty()) - error = QString("Couldn't find a Wineprefix for AppId %1").arg(appid); - QString path = expand( ":PROTON_DIST_PATH/bin" ); @@ -81,14 +73,25 @@ std::tuple<QProcessEnvironment, QString, bool> make_steam_environ(const QString& ); library_path += ':'; library_path += qgetenv("LD_LIBRARY_PATH"); env.insert("LD_LIBRARY_PATH", library_path); - env.insert("WINEPREFIX", app_wineprefix); return ret(env, error, error.isEmpty()); } -QString proton_path(const QString& proton_dist_path) +std::tuple<QString, QString, bool> make_wineprefix(int appid) { - return proton_dist_path + "/bin/wine"; + using ret = std::tuple<QString, QString, bool>; + QString error = ""; + QString app_wineprefix; + for (const char* path : steam_paths) { + QDir dir(QDir::homePath() + path + QString("/%1/pfx").arg(appid)); + if (dir.exists()) + app_wineprefix = dir.absolutePath(); + } + if (app_wineprefix.isEmpty()) + error = QString("Couldn't find a Wineprefix for AppId %1").arg(appid); + + return ret(app_wineprefix, error, error.isEmpty()); } + #endif |