Merge pull request #13294 from Chocobo1/openFile

Fix open path won't work correctly
This commit is contained in:
Mike Tzou
2020-08-30 11:28:46 +08:00
committed by GitHub
3 changed files with 16 additions and 15 deletions

View File

@@ -30,7 +30,7 @@
#ifndef UTILS_STRING_H
#define UTILS_STRING_H
#include <QLatin1String>
#include <QChar>
#include <QVector>
class QString;
@@ -54,13 +54,13 @@ namespace Utils
QString wildcardToRegex(const QString &pattern);
template <typename T>
T unquote(const T &str, const QString &quotes = QLatin1String("\""))
T unquote(const T &str, const QString &quotes = QChar('"'))
{
if (str.length() < 2) return str;
for (const auto &quote : quotes) {
for (const QChar quote : quotes) {
if (str.startsWith(quote) && str.endsWith(quote))
return str.mid(1, str.length() - 2);
return str.mid(1, (str.length() - 2));
}
return str;