mirror of
https://github.com/PrismLauncher/PrismLauncher
synced 2026-04-23 09:05:03 +00:00
fix(PackProfile): don't reset dirty if component list saving failed
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
This commit is contained in:
parent
9776fb8d68
commit
c6072ff434
|
|
@ -167,6 +167,7 @@ static bool savePackProfile(const QString& filename, const ComponentContainer& c
|
|||
}
|
||||
if (!outFile.commit()) {
|
||||
qCCritical(instanceProfileC) << "Couldn't save" << outFile.fileName() << "because:" << outFile.errorString();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
@ -229,9 +230,8 @@ static PackProfile::Result loadPackProfile(PackProfile* parent,
|
|||
|
||||
void PackProfile::saveNow()
|
||||
{
|
||||
if (saveIsScheduled()) {
|
||||
if (saveIsScheduled() && save_internal()) {
|
||||
d->m_saveTimer.stop();
|
||||
save_internal();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -279,12 +279,15 @@ QString PackProfile::patchFilePathForUid(const QString& uid) const
|
|||
return patchesPattern().arg(uid);
|
||||
}
|
||||
|
||||
void PackProfile::save_internal()
|
||||
bool PackProfile::save_internal()
|
||||
{
|
||||
qDebug() << d->m_instance->name() << "|" << "Component list save performed now";
|
||||
auto filename = componentsFilePath();
|
||||
savePackProfile(filename, d->components);
|
||||
d->dirty = false;
|
||||
if (savePackProfile(filename, d->components)) {
|
||||
d->dirty = false;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
PackProfile::Result PackProfile::load()
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ class PackProfile : public QAbstractListModel {
|
|||
QString patchesPattern() const;
|
||||
|
||||
private slots:
|
||||
void save_internal();
|
||||
bool save_internal();
|
||||
void updateSucceeded();
|
||||
void updateFailed(const QString& error);
|
||||
void componentDataChanged();
|
||||
|
|
|
|||
Loading…
Reference in a new issue