builds fixes
This commit is contained in:
@@ -352,6 +352,28 @@ void BuildSwitcher::fail(const QString &message, bool gameDirIntact)
|
||||
emit failed(toId, message, gameDirIntact);
|
||||
}
|
||||
|
||||
// ── Удаление сборки ────────────────────────────────────────────────────────
|
||||
|
||||
bool BuildSwitcher::forgetBuild(int buildId)
|
||||
{
|
||||
if (buildId < 0)
|
||||
return true;
|
||||
|
||||
// Запись убираем в любом случае: даже если файл не удалось стереть, ссылаться
|
||||
// на архив несуществующей сборки нельзя — иначе он «воскреснет» под новой
|
||||
// сборкой с тем же id.
|
||||
QJsonObject index = readIndex();
|
||||
QJsonObject builds = index.value(QStringLiteral("builds")).toObject();
|
||||
builds.remove(QString::number(buildId));
|
||||
index.insert(QStringLiteral("builds"), builds);
|
||||
if (index.value(QStringLiteral("active")).toInt(-1) == buildId)
|
||||
index.remove(QStringLiteral("active"));
|
||||
writeIndex(index);
|
||||
|
||||
QDir dir(buildDir(buildId));
|
||||
return !dir.exists() || dir.removeRecursively();
|
||||
}
|
||||
|
||||
// ── Незавершённое переключение ─────────────────────────────────────────────
|
||||
|
||||
QString BuildSwitcher::interruptedSwitchWarning() const
|
||||
|
||||
Reference in New Issue
Block a user