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();
|
||||
|
||||
private:
|
||||
QDir steamDir() const;
|
||||
|
||||
LauncherCore &m_launcher;
|
||||
};
|
|
@ -16,9 +16,7 @@ CompatibilityToolInstaller::CompatibilityToolInstaller(LauncherCore &launcher, Q
|
|||
|
||||
void CompatibilityToolInstaller::installCompatibilityTool()
|
||||
{
|
||||
const QDir appDataDir = QStandardPaths::standardLocations(QStandardPaths::StandardLocation::HomeLocation)[0];
|
||||
const QDir steamDir = appDataDir.absoluteFilePath(QStringLiteral(".steam"));
|
||||
const QDir steamSteamDir = steamDir.absoluteFilePath(QStringLiteral("steam"));
|
||||
const QDir steamSteamDir = steamDir();
|
||||
if (!steamSteamDir.exists()) {
|
||||
Q_EMIT error(i18n("Could not find a Steam installation."));
|
||||
return;
|
||||
|
@ -91,9 +89,7 @@ void CompatibilityToolInstaller::installCompatibilityTool()
|
|||
|
||||
void CompatibilityToolInstaller::removeCompatibilityTool()
|
||||
{
|
||||
const QDir appDataDir = QStandardPaths::standardLocations(QStandardPaths::StandardLocation::HomeLocation)[0];
|
||||
const QDir steamDir = appDataDir.absoluteFilePath(QStringLiteral(".steam"));
|
||||
const QDir steamSteamDir = steamDir.absoluteFilePath(QStringLiteral("steam"));
|
||||
const QDir steamSteamDir = steamDir();
|
||||
if (!steamSteamDir.exists()) {
|
||||
Q_EMIT error(i18n("Could not find a Steam installation."));
|
||||
return;
|
||||
|
@ -114,24 +110,21 @@ void CompatibilityToolInstaller::removeCompatibilityTool()
|
|||
|
||||
bool CompatibilityToolInstaller::isInstalled() const
|
||||
{
|
||||
const QDir appDataDir = QStandardPaths::standardLocations(QStandardPaths::StandardLocation::HomeLocation)[0];
|
||||
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 compatToolDir = steamDir().absoluteFilePath(QStringLiteral("compatibilitytools.d"));
|
||||
const QDir astraToolDir = compatToolDir.absoluteFilePath(QStringLiteral("astra"));
|
||||
return astraToolDir.exists();
|
||||
}
|
||||
|
||||
bool CompatibilityToolInstaller::hasSteam() const
|
||||
{
|
||||
return steamDir().exists();
|
||||
}
|
||||
|
||||
QDir CompatibilityToolInstaller::steamDir() const
|
||||
{
|
||||
const QDir appDataDir = QStandardPaths::standardLocations(QStandardPaths::StandardLocation::HomeLocation)[0];
|
||||
const QDir steamDir = appDataDir.absoluteFilePath(QStringLiteral(".steam"));
|
||||
const QDir steamSteamDir = steamDir.absoluteFilePath(QStringLiteral("steam"));
|
||||
return steamSteamDir.exists();
|
||||
return steamDir.absoluteFilePath(QStringLiteral("steam"));
|
||||
}
|
||||
|
||||
#include "moc_compatibilitytoolinstaller.cpp"
|
Loading…
Add table
Reference in a new issue