mirror of
https://github.com/redstrate/Astra.git
synced 2025-04-22 04:37:46 +00:00
Redo Profile::winePath and make version detection work again
This commit is contained in:
parent
944798825d
commit
a29609af4b
1 changed files with 33 additions and 35 deletions
|
@ -81,47 +81,15 @@ void Profile::readGameData()
|
||||||
|
|
||||||
void Profile::readWineInfo()
|
void Profile::readWineInfo()
|
||||||
{
|
{
|
||||||
#if defined(Q_OS_MAC)
|
|
||||||
switch (wineType) {
|
|
||||||
case WineType::System: // system wine
|
|
||||||
winePath = "/usr/local/bin/wine64";
|
|
||||||
break;
|
|
||||||
case WineType::Custom: // custom path
|
|
||||||
winePath = profile.winePath;
|
|
||||||
break;
|
|
||||||
case WineType::Builtin: // ffxiv built-in (for mac users)
|
|
||||||
winePath =
|
|
||||||
"/Applications/FINAL FANTASY XIV "
|
|
||||||
"ONLINE.app/Contents/SharedSupport/finalfantasyxiv/FINAL FANTASY XIV ONLINE/wine";
|
|
||||||
break;
|
|
||||||
case WineType::XIVOnMac:
|
|
||||||
winePath = "/Applications/XIV on Mac.app/Contents/Resources/wine/bin/wine64";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(Q_OS_LINUX)
|
|
||||||
switch (wineType()) {
|
|
||||||
case WineType::System: // system wine (should be in $PATH)
|
|
||||||
setWinePath(QStringLiteral("wine"));
|
|
||||||
break;
|
|
||||||
case WineType::Custom: // custom pth
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(Q_OS_LINUX) || defined(Q_OS_MAC)
|
#if defined(Q_OS_LINUX) || defined(Q_OS_MAC)
|
||||||
auto wineProcess = new QProcess(this);
|
auto wineProcess = new QProcess(this);
|
||||||
wineProcess->setProcessChannelMode(QProcess::MergedChannels);
|
|
||||||
|
|
||||||
connect(wineProcess, &QProcess::readyRead, this, [wineProcess, this] {
|
connect(wineProcess, &QProcess::readyReadStandardOutput, this, [wineProcess, this] {
|
||||||
m_wineVersion = wineProcess->readAllStandardOutput().trimmed();
|
m_wineVersion = wineProcess->readAllStandardOutput().trimmed();
|
||||||
Q_EMIT wineChanged();
|
Q_EMIT wineChanged();
|
||||||
});
|
});
|
||||||
|
|
||||||
m_launcher.launchExecutable(*this, wineProcess, {QStringLiteral("--version")}, false, false);
|
wineProcess->start(winePath(), {QStringLiteral("--version")});
|
||||||
|
|
||||||
wineProcess->waitForFinished();
|
wineProcess->waitForFinished();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -156,7 +124,37 @@ void Profile::setGamePath(const QString &path)
|
||||||
|
|
||||||
QString Profile::winePath() const
|
QString Profile::winePath() const
|
||||||
{
|
{
|
||||||
|
#if defined(Q_OS_MAC)
|
||||||
|
switch (wineType()) {
|
||||||
|
case WineType::System: // system wine
|
||||||
|
return "/usr/local/bin/wine64";
|
||||||
|
break;
|
||||||
|
case WineType::Custom: // custom path
|
||||||
return m_config->winePath();
|
return m_config->winePath();
|
||||||
|
break;
|
||||||
|
case WineType::Builtin: // ffxiv built-in (for mac users)
|
||||||
|
return "/Applications/FINAL FANTASY XIV "
|
||||||
|
"ONLINE.app/Contents/SharedSupport/finalfantasyxiv/FINAL FANTASY XIV ONLINE/wine";
|
||||||
|
break;
|
||||||
|
case WineType::XIVOnMac:
|
||||||
|
return "/Applications/XIV on Mac.app/Contents/Resources/wine/bin/wine64";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(Q_OS_LINUX)
|
||||||
|
switch (wineType()) {
|
||||||
|
case WineType::System: // system wine (should be in $PATH)
|
||||||
|
return QStringLiteral("wine");
|
||||||
|
break;
|
||||||
|
case WineType::Custom: // custom pth
|
||||||
|
return m_config->winePath();
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
void Profile::setWinePath(const QString &path)
|
void Profile::setWinePath(const QString &path)
|
||||||
|
|
Loading…
Add table
Reference in a new issue