diff options
author | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2020-07-27 22:31:26 +0200 |
---|---|---|
committer | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2020-08-16 12:15:14 +0200 |
commit | cd352d9052b42781887996da5b0691dd581ce48c (patch) | |
tree | fc0ba0825a711e4cdacf30c008fc7f14e3d0a4a4 /rbutil/rbutilqt/base/utils.cpp | |
parent | d5820ff779397c9de50286d401c5d6422fb84fcb (diff) | |
download | rockbox-cd352d9052b42781887996da5b0691dd581ce48c.tar.gz rockbox-cd352d9052b42781887996da5b0691dd581ce48c.zip |
rbutil: QString::split() changed with Qt 5.14.
Avoid a deprecated warning, and make it compile with Qt6, which removes
the old version.
Change-Id: Iaad10660a0c8bda9d7aa52ee250489ed135bd8a8
Diffstat (limited to 'rbutil/rbutilqt/base/utils.cpp')
-rw-r--r-- | rbutil/rbutilqt/base/utils.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/rbutil/rbutilqt/base/utils.cpp b/rbutil/rbutilqt/base/utils.cpp index e185effe2b..277dcb512c 100644 --- a/rbutil/rbutilqt/base/utils.cpp +++ b/rbutil/rbutilqt/base/utils.cpp @@ -93,7 +93,11 @@ QString Utils::resolvePathCase(QString path) { int start; QString realpath; +#if QT_VERSION >= 0x050e00 + QStringList elems = path.split("/", Qt::SkipEmptyParts); +#else QStringList elems = path.split("/", QString::SkipEmptyParts); +#endif if(path.isEmpty()) return QString(); @@ -280,17 +284,29 @@ QString Utils::findExecutable(QString name) QString exepath; //try autodetect tts #if defined(Q_OS_LINUX) || defined(Q_OS_MACX) || defined(Q_OS_OPENBSD) +#if QT_VERSION >= 0x050e00 + QStringList path = QString(getenv("PATH")).split(":", Qt::SkipEmptyParts); +#else QStringList path = QString(getenv("PATH")).split(":", QString::SkipEmptyParts); +#endif #elif defined(Q_OS_WIN) +#if QT_VERSION >= 0x050e00 + QStringList path = QString(getenv("PATH")).split(";", Qt::SkipEmptyParts); +#else QStringList path = QString(getenv("PATH")).split(";", QString::SkipEmptyParts); #endif +#endif LOG_INFO() << "system path:" << path; for(int i = 0; i < path.size(); i++) { QString executable = QDir::fromNativeSeparators(path.at(i)) + "/" + name; #if defined(Q_OS_WIN) executable += ".exe"; +#if QT_VERSION >= 0x050e00 + QStringList ex = executable.split("\"", Qt::SkipEmptyParts); +#else QStringList ex = executable.split("\"", QString::SkipEmptyParts); +#endif executable = ex.join(""); #endif if(QFileInfo(executable).isExecutable()) |