diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2020-05-28 15:57:35 +0200 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2020-05-29 11:40:54 +0000 |
commit | 4a6aa35a9151e083a45e76d04a847832bc7d588c (patch) | |
tree | d30af01a6a5f40d49b467de110f6d261926700a9 /src/libs/utils/fileutils.cpp | |
parent | c8d7c074f56922153923356581fcbd6d15f79110 (diff) |
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 <hjk@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Diffstat (limited to 'src/libs/utils/fileutils.cpp')
-rw-r--r-- | src/libs/utils/fileutils.cpp | 4 |
1 files 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); |