summaryrefslogtreecommitdiffhomepage
path: root/proto-wine/ftnoir_protocol_wine_dialog.cpp
diff options
context:
space:
mode:
authorRussell Sim <russell.sim@gmail.com>2020-06-13 15:05:22 +0200
committerRussell Sim <russell.sim@gmail.com>2020-06-13 15:07:20 +0200
commitf04ecec2acd165e6dd5692fed21d0667bbf3ac52 (patch)
treef10b26f406a4fc9fb82dbc93156d56032afc1488 /proto-wine/ftnoir_protocol_wine_dialog.cpp
parent442c01a60ed376c8693255a7649666113250bf37 (diff)
Proton directory discovery
Use search paths to find proton wine and the app directory, so that we can support steam installations in multiple locations and 3rd party proton installations.
Diffstat (limited to 'proto-wine/ftnoir_protocol_wine_dialog.cpp')
-rw-r--r--proto-wine/ftnoir_protocol_wine_dialog.cpp26
1 files changed, 19 insertions, 7 deletions
diff --git a/proto-wine/ftnoir_protocol_wine_dialog.cpp b/proto-wine/ftnoir_protocol_wine_dialog.cpp
index b590ee94..76ccfdb5 100644
--- a/proto-wine/ftnoir_protocol_wine_dialog.cpp
+++ b/proto-wine/ftnoir_protocol_wine_dialog.cpp
@@ -1,19 +1,32 @@
#include "ftnoir_protocol_wine.h"
#include <QDebug>
+#include <QDir>
+
#include "api/plugin-api.hpp"
-static const char* proton_versions[] = {
- "5.0", "4.11", "4.2", "3.16", "3.7",
+static const char* proton_paths[] = {
+ "/.steam/steam/steamapps/common",
+ "/.steam/root/compatibilitytools.d",
+ "/.local/share/Steam/steamapps/common",
};
+static const QStringList proton_filter = { "Proton*" };
+
FTControls::FTControls()
{
ui.setupUi(this);
- for (const char* version : proton_versions)
- ui.proton_version->addItem(version, QVariant{version});
-
- tie_setting(s.proton_version, ui.proton_version);
+ for (const char* path : proton_paths) {
+ QDir dir(QDir::homePath() + path);
+ dir.setFilter(QDir::Dirs);
+ dir.setNameFilters(proton_filter);
+ QFileInfoList list = dir.entryInfoList();
+ for (int i = 0; i < list.size(); ++i) {
+ QFileInfo fileInfo = list.at(i);
+ ui.proton_version->addItem(fileInfo.fileName(), QVariant{fileInfo.filePath()});
+ }
+ }
+ tie_setting(s.proton_path, ui.proton_version);
tie_setting(s.variant_wine, ui.variant_wine);
tie_setting(s.variant_proton, ui.variant_proton);
tie_setting(s.esync, ui.esync);
@@ -37,4 +50,3 @@ void FTControls::doCancel()
s.b->reload();
close();
}
-