summaryrefslogtreecommitdiffhomepage
path: root/proto-wine
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2019-10-27 07:51:20 +0100
committerStanislaw Halik <sthalik@misaki.pl>2019-10-28 07:45:44 +0100
commit9aef0bbdd753939623562f6112adf4e19576c015 (patch)
tree05a94979c42517ac5a2eb44300470775a2d2ca26 /proto-wine
parenta5a2ec4f7a855ad35bde6362796a0a07fd419cf7 (diff)
proto/wine: assume HOME exists in environ
Diffstat (limited to 'proto-wine')
-rw-r--r--proto-wine/proton.cpp38
1 files changed, 3 insertions, 35 deletions
diff --git a/proto-wine/proton.cpp b/proto-wine/proton.cpp
index c36dbc86..9cc4af30 100644
--- a/proto-wine/proton.cpp
+++ b/proto-wine/proton.cpp
@@ -7,47 +7,14 @@
#ifndef OTR_WINE_NO_WRAPPER
-#include <sys/types.h>
-#include <pwd.h>
-#include <unistd.h>
-#include <errno.h>
-
-#include <memory>
-
#include <QtGlobal>
#include <QString>
#include <QProcessEnvironment>
-#include <QDebug>
-
-static QString home_directory()
-{
- struct passwd *pwptr = nullptr, pw{};
- uid_t uid = getuid();
- int shift = 16;
- do {
- auto buf = std::make_unique<char[]>(1 << shift);
- int error = getpwuid_r(uid, &pw, buf.get(), 1 << shift, &pwptr);
- if (error)
- {
- if (errno != EDOM)
- return {};
- else
- continue;
- }
- else
- break;
- } while (++shift < 28);
-
- if (!pwptr)
- return {};
-
- return pwptr->pw_dir;
-}
QProcessEnvironment make_steam_environ(const QString& proton_version)
{
auto ret = QProcessEnvironment::systemEnvironment();
- QString home = home_directory();
+ QString home = qgetenv("HOME");
auto expand = [&](QString x) {
x.replace("HOME", home);
@@ -89,7 +56,8 @@ QProcessEnvironment make_steam_environ(const QString& proton_version)
QString proton_path(const QString& proton_version)
{
QString wine_path = "HOME/.local/share/Steam/steamapps/common/Proton PROTON/dist/bin/wine";
- wine_path.replace("HOME", home_directory()); wine_path.replace("PROTON", proton_version);
+ wine_path.replace("HOME", qgetenv("HOME"));
+ wine_path.replace("PROTON", proton_version);
return wine_path;
}