aboutsummaryrefslogtreecommitdiff
path: root/launcher
diff options
context:
space:
mode:
authorSefa Eyeoglu <contact@scrumplex.net>2022-11-10 19:04:42 +0100
committerSefa Eyeoglu <contact@scrumplex.net>2022-11-12 20:28:30 +0100
commitfe94c3609ef875166b71b9f6c540c45eff97a5ab (patch)
tree4d84b18c8639233c47e6fc37bfc673489abdbf03 /launcher
parent173aed7fd8e73b9e6a6055981ce284ea9cf5d33a (diff)
downloadPrismLauncher-fe94c3609ef875166b71b9f6c540c45eff97a5ab.tar.gz
PrismLauncher-fe94c3609ef875166b71b9f6c540c45eff97a5ab.tar.bz2
PrismLauncher-fe94c3609ef875166b71b9f6c540c45eff97a5ab.zip
fix: implement code review suggestions
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
Diffstat (limited to 'launcher')
-rw-r--r--launcher/Application.cpp5
-rw-r--r--launcher/DataMigrationTask.cpp12
-rw-r--r--launcher/FileSystem.cpp2
3 files changed, 13 insertions, 6 deletions
diff --git a/launcher/Application.cpp b/launcher/Application.cpp
index 8955e297..537e3903 100644
--- a/launcher/Application.cpp
+++ b/launcher/Application.cpp
@@ -1611,10 +1611,9 @@ bool Application::handleDataMigration(const QString& currentData,
const QString& name,
const QString& configFile) const
{
- QString nomigratePath = FS::PathCombine(oldData, BuildConfig.LAUNCHER_NAME + "_nomigrate.txt");
+ QString nomigratePath = FS::PathCombine(currentData, name + "_nomigrate.txt");
QStringList configPaths = { FS::PathCombine(oldData, configFile), FS::PathCombine(oldData, BuildConfig.LAUNCHER_CONFIGFILE) };
- QDir dir; // helper for QDir::exists
QLocale locale;
// Is there a valid config at the old location?
@@ -1677,7 +1676,7 @@ bool Application::handleDataMigration(const QString& currentData,
matcher->add(std::make_shared<SimplePrefixMatcher>("mods/"));
matcher->add(std::make_shared<SimplePrefixMatcher>("themes/"));
- ProgressDialog diag = ProgressDialog();
+ ProgressDialog diag;
DataMigrationTask task(nullptr, oldData, currentData, matcher);
if (diag.execWithTask(&task)) {
qDebug() << "<> Migration succeeded";
diff --git a/launcher/DataMigrationTask.cpp b/launcher/DataMigrationTask.cpp
index 8de3158e..27ce5f01 100644
--- a/launcher/DataMigrationTask.cpp
+++ b/launcher/DataMigrationTask.cpp
@@ -40,8 +40,12 @@ void DataMigrationTask::dryRunFinished()
disconnect(&m_copyFutureWatcher, &QFutureWatcher<bool>::finished, this, &DataMigrationTask::dryRunFinished);
disconnect(&m_copyFutureWatcher, &QFutureWatcher<bool>::canceled, this, &DataMigrationTask::dryRunAborted);
+#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
+ if (!m_copyFuture.isValid() || !m_copyFuture.result()) {
+#else
if (!m_copyFuture.result()) {
- emitFailed("Some error"); // FIXME
+#endif
+ emitFailed(tr("Failed to scan source path."));
return;
}
@@ -74,8 +78,12 @@ void DataMigrationTask::copyFinished()
disconnect(&m_copyFutureWatcher, &QFutureWatcher<bool>::finished, this, &DataMigrationTask::copyFinished);
disconnect(&m_copyFutureWatcher, &QFutureWatcher<bool>::canceled, this, &DataMigrationTask::copyAborted);
+#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
+ if (!m_copyFuture.isValid() || !m_copyFuture.result()) {
+#else
if (!m_copyFuture.result()) {
- emitFailed("Some paths could not be copied!");
+#endif
+ emitFailed(tr("Some paths could not be copied!"));
return;
}
diff --git a/launcher/FileSystem.cpp b/launcher/FileSystem.cpp
index 06691fbf..0c6527b1 100644
--- a/launcher/FileSystem.cpp
+++ b/launcher/FileSystem.cpp
@@ -175,7 +175,7 @@ bool copy::operator()(const QString& offset, bool dryRun)
// Function that'll do the actual copying
auto copy_file = [&](QString src_path, QString relative_dst_path) {
- if (m_matcher && (m_matcher->matches(relative_dst_path) == !m_whitelist))
+ if (m_matcher && (m_matcher->matches(relative_dst_path) != m_whitelist))
return;
auto dst_path = PathCombine(dst, relative_dst_path);