| 281 | } |
| 282 | |
| 283 | void Profile::createTweakedIniFile() |
| 284 | { |
| 285 | QString tweakedIni = m_Directory.absoluteFilePath("initweaks.ini"); |
| 286 | |
| 287 | if (QFile::exists(tweakedIni) && !shellDeleteQuiet(tweakedIni)) { |
| 288 | const auto e = GetLastError(); |
| 289 | reportError(tr("failed to update tweaked ini file, wrong settings may be used: %1") |
| 290 | .arg(QString::fromStdWString(formatSystemMessage(e)))); |
| 291 | return; |
| 292 | } |
| 293 | |
| 294 | for (const auto& [priority, index] : m_ModIndexByPriority) { |
| 295 | if (m_ModStatus[index].m_Enabled) { |
| 296 | ModInfo::Ptr modInfo = ModInfo::getByIndex(index); |
| 297 | mergeTweaks(modInfo, tweakedIni); |
| 298 | } |
| 299 | } |
| 300 | |
| 301 | mergeTweak(getProfileTweaks(), tweakedIni); |
| 302 | |
| 303 | bool error = false; |
| 304 | if (!MOBase::WriteRegistryValue(L"Archive", L"bInvalidateOlderFiles", L"1", |
| 305 | ToWString(tweakedIni).c_str())) { |
| 306 | error = true; |
| 307 | } |
| 308 | |
| 309 | if (error) { |
| 310 | const auto e = ::GetLastError(); |
| 311 | reportError(tr("failed to create tweaked ini: %1") |
| 312 | .arg(QString::fromStdWString(formatSystemMessage(e)))); |
| 313 | } |
| 314 | } |
| 315 | |
| 316 | // static |
| 317 | void Profile::renameModInAllProfiles(const QString& oldName, const QString& newName) |
no test coverage detected