summaryrefslogtreecommitdiff
path: root/src/profile.cpp
diff options
context:
space:
mode:
authorTannin <devnull@localhost>2013-03-13 19:35:20 +0100
committerTannin <devnull@localhost>2013-03-13 19:35:20 +0100
commitb3d0fcb2083143dc21c751adafd2523c3555e5d2 (patch)
tree6adeeedc26848af1d5dd96be17b4bca97ede085d /src/profile.cpp
parent93e073c32445eefba5595123b28acf87d9f409e8 (diff)
- some more safety checks in the ini-limit removal code
- some code cleanup and minor bug fixes based on results from static code analysis - added naemfilter for the esp list - bsa changes are now stored automatically but delayed by up to 0.5 seconds (for performance reasons) - bugfix: buffer overrun when certain functions are called with empty file names - bugfix: reroute for the ini-limit fix was placed in the data segment - bugfix: mod list got mixed up when the mod directory was changed externally - bugfix: plugins.txt reroute on skyrim didn't work on winXP - bugfix: MO could become unresponsive if the tutorial script couldn't be interpreted
Diffstat (limited to 'src/profile.cpp')
-rw-r--r--src/profile.cpp21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/profile.cpp b/src/profile.cpp
index 002c93c0..67fd1e13 100644
--- a/src/profile.cpp
+++ b/src/profile.cpp
@@ -130,8 +130,10 @@ void Profile::cancelWriteModlist() const
}
-void Profile::writeModlistNow() const
+void Profile::writeModlistNow(bool onlyOnTimer) const
{
+ if (onlyOnTimer && !m_SaveTimer->isActive()) return;
+
m_SaveTimer->stop();
#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")
@@ -194,11 +196,6 @@ void Profile::createTweakedIniFile()
void Profile::refreshModStatus()
{
- // don't lose changes!
- if (m_SaveTimer->isActive()) {
- writeModlistNow();
- }
-
QFile file(getModlistFileName());
if (!file.exists()) {
throw MyException(QObject::tr("failed to find \"%1\"").arg(getModlistFileName()));
@@ -571,11 +568,15 @@ void Profile::deactivateInvalidation() const
}
}
+ // just to be safe...
+ ::SetFileAttributesW(iniFileName.c_str(), FILE_ATTRIBUTE_NORMAL);
+
if (!::WritePrivateProfileStringW(L"Archive", GameInfo::instance().archiveListKey().c_str(),
ToWString(archives.join(", ").toUtf8()).c_str(), iniFileName.c_str()) ||
!::WritePrivateProfileStringW(L"Archive", L"bInvalidateOlderFiles", L"0", iniFileName.c_str()) ||
!::WritePrivateProfileStringW(L"Archive", L"SInvalidationFile", L"ArchiveInvalidation.txt", iniFileName.c_str())) {
- throw windows_error("failed to modify ini file");
+ QString errorMessage = tr("failed to modify \"%1\"").arg(ToQString(iniFileName));
+ throw windows_error(errorMessage.toUtf8().constData());
}
}
}
@@ -598,11 +599,15 @@ void Profile::activateInvalidation(const QString& dataDirectory) const
archives.insert(0, invalidationBSA);
}
+ // just to be safe...
+ ::SetFileAttributesW(iniFileName.c_str(), FILE_ATTRIBUTE_NORMAL);
+
if (!::WritePrivateProfileStringW(L"Archive", GameInfo::instance().archiveListKey().c_str(),
ToWString(archives.join(", ").toUtf8()).c_str(), iniFileName.c_str()) ||
!::WritePrivateProfileStringW(L"Archive", L"bInvalidateOlderFiles", L"1", iniFileName.c_str()) ||
!::WritePrivateProfileStringW(L"Archive", L"SInvalidationFile", L"", iniFileName.c_str())) {
- throw windows_error("failed to modify ini file");
+ QString errorMessage = tr("failed to modify \"%1\"").arg(ToQString(iniFileName));
+ throw windows_error(errorMessage.toUtf8().constData());
}
QString bsaFile = dataDirectory + "/" + invalidationBSA;