mirror of
https://github.com/redstrate/Astra.git
synced 2025-05-01 08:27:45 +00:00
Shove all the steam dir calculation into one function
This commit is contained in:
parent
b15c42ac4c
commit
e7ae19da6e
2 changed files with 11 additions and 16 deletions
|
@ -32,5 +32,7 @@ Q_SIGNALS:
|
||||||
void isInstalledChanged();
|
void isInstalledChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
QDir steamDir() const;
|
||||||
|
|
||||||
LauncherCore &m_launcher;
|
LauncherCore &m_launcher;
|
||||||
};
|
};
|
|
@ -16,9 +16,7 @@ CompatibilityToolInstaller::CompatibilityToolInstaller(LauncherCore &launcher, Q
|
||||||
|
|
||||||
void CompatibilityToolInstaller::installCompatibilityTool()
|
void CompatibilityToolInstaller::installCompatibilityTool()
|
||||||
{
|
{
|
||||||
const QDir appDataDir = QStandardPaths::standardLocations(QStandardPaths::StandardLocation::HomeLocation)[0];
|
const QDir steamSteamDir = steamDir();
|
||||||
const QDir steamDir = appDataDir.absoluteFilePath(QStringLiteral(".steam"));
|
|
||||||
const QDir steamSteamDir = steamDir.absoluteFilePath(QStringLiteral("steam"));
|
|
||||||
if (!steamSteamDir.exists()) {
|
if (!steamSteamDir.exists()) {
|
||||||
Q_EMIT error(i18n("Could not find a Steam installation."));
|
Q_EMIT error(i18n("Could not find a Steam installation."));
|
||||||
return;
|
return;
|
||||||
|
@ -91,9 +89,7 @@ void CompatibilityToolInstaller::installCompatibilityTool()
|
||||||
|
|
||||||
void CompatibilityToolInstaller::removeCompatibilityTool()
|
void CompatibilityToolInstaller::removeCompatibilityTool()
|
||||||
{
|
{
|
||||||
const QDir appDataDir = QStandardPaths::standardLocations(QStandardPaths::StandardLocation::HomeLocation)[0];
|
const QDir steamSteamDir = steamDir();
|
||||||
const QDir steamDir = appDataDir.absoluteFilePath(QStringLiteral(".steam"));
|
|
||||||
const QDir steamSteamDir = steamDir.absoluteFilePath(QStringLiteral("steam"));
|
|
||||||
if (!steamSteamDir.exists()) {
|
if (!steamSteamDir.exists()) {
|
||||||
Q_EMIT error(i18n("Could not find a Steam installation."));
|
Q_EMIT error(i18n("Could not find a Steam installation."));
|
||||||
return;
|
return;
|
||||||
|
@ -114,24 +110,21 @@ void CompatibilityToolInstaller::removeCompatibilityTool()
|
||||||
|
|
||||||
bool CompatibilityToolInstaller::isInstalled() const
|
bool CompatibilityToolInstaller::isInstalled() const
|
||||||
{
|
{
|
||||||
const QDir appDataDir = QStandardPaths::standardLocations(QStandardPaths::StandardLocation::HomeLocation)[0];
|
const QDir compatToolDir = steamDir().absoluteFilePath(QStringLiteral("compatibilitytools.d"));
|
||||||
const QDir steamDir = appDataDir.absoluteFilePath(QStringLiteral(".steam"));
|
|
||||||
const QDir steamSteamDir = steamDir.absoluteFilePath(QStringLiteral("steam"));
|
|
||||||
if (!steamSteamDir.exists()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
const QDir compatToolDir = steamSteamDir.absoluteFilePath(QStringLiteral("compatibilitytools.d"));
|
|
||||||
const QDir astraToolDir = compatToolDir.absoluteFilePath(QStringLiteral("astra"));
|
const QDir astraToolDir = compatToolDir.absoluteFilePath(QStringLiteral("astra"));
|
||||||
return astraToolDir.exists();
|
return astraToolDir.exists();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CompatibilityToolInstaller::hasSteam() const
|
bool CompatibilityToolInstaller::hasSteam() const
|
||||||
|
{
|
||||||
|
return steamDir().exists();
|
||||||
|
}
|
||||||
|
|
||||||
|
QDir CompatibilityToolInstaller::steamDir() const
|
||||||
{
|
{
|
||||||
const QDir appDataDir = QStandardPaths::standardLocations(QStandardPaths::StandardLocation::HomeLocation)[0];
|
const QDir appDataDir = QStandardPaths::standardLocations(QStandardPaths::StandardLocation::HomeLocation)[0];
|
||||||
const QDir steamDir = appDataDir.absoluteFilePath(QStringLiteral(".steam"));
|
const QDir steamDir = appDataDir.absoluteFilePath(QStringLiteral(".steam"));
|
||||||
const QDir steamSteamDir = steamDir.absoluteFilePath(QStringLiteral("steam"));
|
return steamDir.absoluteFilePath(QStringLiteral("steam"));
|
||||||
return steamSteamDir.exists();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "moc_compatibilitytoolinstaller.cpp"
|
#include "moc_compatibilitytoolinstaller.cpp"
|
Loading…
Add table
Reference in a new issue