Utils: Re-add some safety net in FilePath::setPath()

Amends c08317b5a6

Change-Id: I3b9bc61346aa60280beb3b29c33c0f76017e407a
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2023-01-16 13:21:04 +01:00
parent cc89b79bc2
commit 7cd2026fa2

View File

@@ -877,11 +877,22 @@ void FilePath::setPath(QStringView path)
setParts(scheme(), host(), path); setParts(scheme(), host(), path);
} }
void FilePath::setFromString(const QStringView fileNameView) void FilePath::setFromString(QStringView fileNameView)
{ {
static const QStringView qtcDevSlash(u"__qtc_devices__/"); static const QStringView qtcDevSlash(u"__qtc_devices__/");
static const QStringView colonSlashSlash(u"://"); static const QStringView colonSlashSlash(u"://");
#if 1
// FIXME: Remove below once the calling code is adjusted
QString dummy;
if (fileNameView.contains(u'\\')) {
QTC_CHECK(false);
dummy = fileNameView.toString();
dummy.replace('\\', '/');
fileNameView = dummy;
}
#endif
const QChar slash('/'); const QChar slash('/');
bool startsWithQtcSlashDev = false; bool startsWithQtcSlashDev = false;