From 4a6aa35a9151e083a45e76d04a847832bc7d588c Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Thu, 28 May 2020 15:57:35 +0200 Subject: Utils: Do not use QDir::cleanPath() in FilePath::fromUserInput() Some of the functionality of QDir::cleanPath() breaks the use of Creator's variables. For instance, "%{sourceDir}/.." becomes ".". This has hit us before; see commit 8bc7e04012. It's not always possible to expand strings before converting them to FilePath, and it would require a lot of work to change all occurrences of potentially unexpanded FilePaths to QStrings, so it seems like the more practical solution to allow unexpanded FilePaths. Fixes: QTCREATORBUG-24095 Change-Id: I5fbbd181cb888b129f11c120e363228bc52b090a Reviewed-by: hjk Reviewed-by: Christian Stenger Reviewed-by: Eike Ziller --- src/libs/utils/fileutils.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libs/utils/fileutils.cpp b/src/libs/utils/fileutils.cpp index 980ee4c0d6..307f3af06d 100644 --- a/src/libs/utils/fileutils.cpp +++ b/src/libs/utils/fileutils.cpp @@ -842,10 +842,10 @@ FilePath FilePath::fromStringWithExtension(const QString &filepath, const QStrin } /// Constructs a FilePath from \a filePath -/// \a filePath is only passed through QDir::cleanPath +/// \a filePath is only passed through QDir::fromNativeSeparators FilePath FilePath::fromUserInput(const QString &filePath) { - QString clean = QDir::cleanPath(filePath); + QString clean = QDir::fromNativeSeparators(filePath); if (clean.startsWith(QLatin1String("~/"))) clean = QDir::homePath() + clean.mid(1); return FilePath::fromString(clean); -- cgit v1.2.1