aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRachel Powers <508861+Ryex@users.noreply.github.com>2023-02-09 20:02:20 -0700
committerRachel Powers <508861+Ryex@users.noreply.github.com>2023-03-20 14:56:32 -0700
commit34ac8b3ec345a0c1c909111e8e0a89fa84c13673 (patch)
tree0515a6218f58472ccbf79ceb4d3849b19c33d841
parent2837236d81b882f041a1cefadc86ca9d5f09ceeb (diff)
downloadPrismLauncher-34ac8b3ec345a0c1c909111e8e0a89fa84c13673.tar.gz
PrismLauncher-34ac8b3ec345a0c1c909111e8e0a89fa84c13673.tar.bz2
PrismLauncher-34ac8b3ec345a0c1c909111e8e0a89fa84c13673.zip
fix: Qt < 5.14.0 compat
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
-rw-r--r--launcher/FileSystem.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/launcher/FileSystem.cpp b/launcher/FileSystem.cpp
index 4ee3899b..57b796ad 100644
--- a/launcher/FileSystem.cpp
+++ b/launcher/FileSystem.cpp
@@ -38,6 +38,7 @@
#include "FileSystem.h"
#include <qdebug.h>
#include <qfileinfo.h>
+#include <qnamespace.h>
#include <qstorageinfo.h>
#include "BuildConfig.h"
@@ -587,9 +588,13 @@ int PathDepth(const QString& path)
QFileInfo info(path);
+#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
+ auto parts = QDir::toNativeSeparators(info.path()).split(QDir::separator(), QString::SkipEmptyParts);
+#else
auto parts = QDir::toNativeSeparators(info.path()).split(QDir::separator(), Qt::SkipEmptyParts);
+#endif
- int numParts = QDir::toNativeSeparators(info.path()).split(QDir::separator(), Qt::SkipEmptyParts).length();
+ int numParts = parts.length();
numParts -= parts.count(".");
numParts -= parts.count("..") * 2;
@@ -606,7 +611,12 @@ QString PathTruncate(const QString& path, int depth)
return PathTruncate(trunc, depth);
}
+#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
+ auto parts = QDir::toNativeSeparators(trunc).split(QDir::separator(), QString::SkipEmptyParts);
+#else
auto parts = QDir::toNativeSeparators(trunc).split(QDir::separator(), Qt::SkipEmptyParts);
+#endif
+
if (parts.startsWith(".") && !path.startsWith(".")) {
parts.removeFirst();
}