From 0eb1662a0eaf8eee680cab5b913fff3fcc9b8b2f Mon Sep 17 00:00:00 2001 From: Tannin Date: Mon, 5 May 2014 18:24:15 +0200 Subject: - very effective optimization to findfirstfile-calls - several configuration files are now only saved to disk if the content actually changed. This should also get rid of a problem where plugins.txt was re-written immediately after starting the game (causing a conflict with the game) - reduced "noise" from hook.dll - removed some debugging messages --- src/profile.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/profile.cpp') diff --git a/src/profile.cpp b/src/profile.cpp index 42358b7d..8d02c047 100644 --- a/src/profile.cpp +++ b/src/profile.cpp @@ -147,7 +147,6 @@ void Profile::writeModlistNow(bool onlyOnTimer) const m_SaveTimer->stop(); if (!m_Directory.exists()) return; -#pragma message("right now, this is doing unnecessary saves. Need a flag that says that mod priority, enabled-state or name of a mod has changed") try { QString fileName = getModlistFileName(); @@ -175,9 +174,9 @@ void Profile::writeModlistNow(bool onlyOnTimer) const } } - file.commit(); - - qDebug("%s saved", QDir::toNativeSeparators(fileName).toUtf8().constData()); + if (file.commitIfDifferent(m_LastModlistHash)) { + qDebug("%s saved", QDir::toNativeSeparators(fileName).toUtf8().constData()); + } } catch (const std::exception &e) { reportError(tr("failed to write mod list: %1").arg(e.what())); return; -- cgit v1.3.1