Qt: Move most recent migration to updater

Saves checking on every startup.
pull/3746/head
Stenzek 1 month ago
parent 61b31b3e28
commit b429993e08
No known key found for this signature in database

@ -935,34 +935,6 @@ void QtHost::ApplyMigrations()
}
}
}
#ifdef _WIN32
#ifdef _DEBUG
#define SUFFIX "d"
#else
#define SUFFIX
#endif
// Remove Qt6Svg.dll and the plugins which use QtSvg, since the updater can't remove them itself...
for (const char* path_to_remove : {
"Qt6Svg" SUFFIX ".dll",
"QtPlugins\\iconengines\\qsvgicon" SUFFIX ".dll",
"QtPlugins\\imageformats\\qsvg" SUFFIX ".dll",
})
{
const std::string full_path = Path::Combine(EmuFolders::AppRoot, path_to_remove);
if (FileSystem::FileExists(full_path.c_str()))
{
Error error;
if (!FileSystem::DeleteFile(full_path.c_str(), &error))
{
QMessageBox::critical(nullptr, "Error"_L1,
QString::fromStdString(fmt::format("Failed to delete conflicting library {}: {}",
path_to_remove, error.GetDescription())));
}
}
}
#undef SUFFIX
#endif
}
void CoreThread::applySettings(bool display_osd_messages /* = false */)

@ -450,6 +450,27 @@ void Updater::CleanupStagingDirectory()
m_progress->FormatError("Failed to remove staging directory '{}'", m_staging_directory);
}
void Updater::CleanupStaleFiles()
{
#ifdef _WIN32
// Remove Qt6Svg.dll and the plugins which use QtSvg, since the staging/extraction won't remove it...
for (const char* path_to_remove : {
"Qt6Svg.dll",
"QtPlugins\\iconengines\\qsvgicon.dll",
"QtPlugins\\imageformats\\qsvg.dll",
})
{
const std::string path = Path::Combine(m_destination_directory, path_to_remove);
if (!FileSystem::FileExists(path.c_str()))
continue;
Error error;
if (!FileSystem::DeleteFile(path.c_str(), &error))
m_progress->FormatModalError("Failed to remove file '{}': {}", path, error.GetDescription());
}
#endif
}
bool Updater::ClearDestinationDirectory()
{
return RecursiveDeleteDirectory(m_destination_directory.c_str(), false);

@ -24,6 +24,7 @@ public:
bool StageUpdate();
bool CommitUpdate();
void CleanupStagingDirectory();
void CleanupStaleFiles();
bool ClearDestinationDirectory();
private:

@ -102,6 +102,7 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLi
updater.CleanupStagingDirectory();
updater.RemoveUpdateZip();
updater.CleanupStaleFiles();
progress.FormatInformation("Launching '{}'...", StringUtil::WideStringToUTF8String(program_to_launch));
ShellExecuteW(nullptr, L"open", program_to_launch.c_str(), L"-updatecleanup", nullptr, SW_SHOWNORMAL);

Loading…
Cancel
Save