forked from qt-creator/qt-creator
CompilationDatabase: Clean paths
File paths in compile_database.json may contain redundant components ("./" or "../"). These confuse the code model, which then fails to associate the document with the project node. Change-Id: I7c74a24789a67b761b0737a41d1dd70d2dfd5f3d Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
committed by
Martin Kampas
parent
7125406305
commit
10c0cdc10f
@@ -167,8 +167,8 @@ static QStringList jsonObjectFlags(const QJsonObject &object, QSet<QString> &fla
|
|||||||
|
|
||||||
static FilePath jsonObjectFilename(const QJsonObject &object)
|
static FilePath jsonObjectFilename(const QJsonObject &object)
|
||||||
{
|
{
|
||||||
const QString workingDir = QDir::fromNativeSeparators(object["directory"].toString());
|
const QString workingDir = QDir::cleanPath(object["directory"].toString());
|
||||||
FilePath fileName = FilePath::fromString(QDir::fromNativeSeparators(object["file"].toString()));
|
FilePath fileName = FilePath::fromString(QDir::cleanPath(object["file"].toString()));
|
||||||
if (fileName.toFileInfo().isRelative())
|
if (fileName.toFileInfo().isRelative())
|
||||||
fileName = FilePath::fromString(QDir::cleanPath(workingDir + "/" + fileName.toString()));
|
fileName = FilePath::fromString(QDir::cleanPath(workingDir + "/" + fileName.toString()));
|
||||||
return fileName;
|
return fileName;
|
||||||
|
Reference in New Issue
Block a user