From cab81a5d0338d10f541a72288b4b506539e0da33 Mon Sep 17 00:00:00 2001 From: hjk Date: Wed, 7 Jun 2023 09:48:25 +0200 Subject: [PATCH] QMakeProjectManager: Proliferate FilePath use a bit Task-number: QTCREATORBUG-29140 Change-Id: I66511871789cd7428695eba8720e7ef6a2236497 Reviewed-by: Marcus Tillmanns --- .../qmakebuildconfiguration.cpp | 24 ++++++++----------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/src/plugins/qmakeprojectmanager/qmakebuildconfiguration.cpp b/src/plugins/qmakeprojectmanager/qmakebuildconfiguration.cpp index 9da9f7f65a7..39618c41956 100644 --- a/src/plugins/qmakeprojectmanager/qmakebuildconfiguration.cpp +++ b/src/plugins/qmakeprojectmanager/qmakebuildconfiguration.cpp @@ -643,33 +643,29 @@ QString QmakeBuildConfiguration::extractSpecFromArguments(QString *args, if (parsedSpec.isEmpty()) return {}; - FilePath baseMkspecDir = FilePath::fromUserInput(version->hostDataPath().toString() - + "/mkspecs"); - baseMkspecDir = FilePath::fromString(baseMkspecDir.toFileInfo().canonicalFilePath()); + const FilePath baseMkspecDir = version->hostDataPath().pathAppended("mkspecs") + .canonicalPath(); // if the path is relative it can be // relative to the working directory (as found in the Makefiles) // or relatively to the mkspec directory // if it is the former we need to get the canonical form // for the other one we don't need to do anything - if (parsedSpec.toFileInfo().isRelative()) { - if (QFileInfo::exists(directory.path() + QLatin1Char('/') + parsedSpec.toString())) - parsedSpec = FilePath::fromUserInput(directory.path() + QLatin1Char('/') + parsedSpec.toString()); + if (parsedSpec.isRelativePath()) { + FilePath mkspecs = directory.pathAppended(parsedSpec.path()); + if (mkspecs.exists()) + parsedSpec = mkspecs; else - parsedSpec = FilePath::fromUserInput(baseMkspecDir.toString() + QLatin1Char('/') + parsedSpec.toString()); + parsedSpec = baseMkspecDir.pathAppended(parsedSpec.path()); } - QFileInfo f2 = parsedSpec.toFileInfo(); - while (f2.isSymLink()) { - parsedSpec = FilePath::fromString(f2.symLinkTarget()); - f2.setFile(parsedSpec.toString()); - } + while (parsedSpec.isSymLink()) + parsedSpec = parsedSpec.symLinkTarget(); if (parsedSpec.isChildOf(baseMkspecDir)) { parsedSpec = parsedSpec.relativeChildPath(baseMkspecDir); } else { - FilePath sourceMkSpecPath = FilePath::fromString(version->sourcePath().toString() - + QLatin1String("/mkspecs")); + FilePath sourceMkSpecPath = version->sourcePath().pathAppended("mkspecs"); if (parsedSpec.isChildOf(sourceMkSpecPath)) parsedSpec = parsedSpec.relativeChildPath(sourceMkSpecPath); }