Add progress bars where the launcher can be limited by IO

I tested this with a USB3 external hard drive.

These two places were the only ones where we're IO-bound and block the main thread, so they're the only ones that need progress bars.

If trying to replicate this test, then it's important to unplug the hard drive between each repeat.
Apparently Windows is excellent at disk caching these days as it takes a minute and a half to start the launcher with Total Overhaul on this drive when it's just been plugged in, but less time than the first launch after a reboot on an NVME drive once the cache has been warmed up.
This commit is contained in:
AnyOldName3 2025-04-09 01:36:52 +01:00
parent 894ea4ba62
commit 096759435a
2 changed files with 15 additions and 0 deletions

View file

@ -1,6 +1,7 @@
#include "gamesettings.hpp"
#include <QDir>
#include <QProgressDialog>
#include <QRegularExpression>
#include <components/files/configurationmanager.hpp>
@ -37,8 +38,13 @@ void Config::GameSettings::validatePaths()
mDataDirs.clear();
QProgressDialog progressBar("Validating paths", {}, 0, paths.count() + 1);
progressBar.setWindowModality(Qt::WindowModal);
progressBar.setValue(0);
for (const auto& dataDir : paths)
{
progressBar.setValue(progressBar.value() + 1);
if (QDir(dataDir.value).exists())
{
SettingValue copy = dataDir;
@ -50,6 +56,8 @@ void Config::GameSettings::validatePaths()
// Do the same for data-local
const QString& local = mSettings.value(QString("data-local")).value;
progressBar.setValue(progressBar.value() + 1);
if (!local.isEmpty() && QDir(local).exists())
{
mDataLocal = QDir(local).canonicalPath();