ProjectExplorer: Fix JsonWizardScannerGenerator

Both calls of FilePath::relativePath() were "reversed".

Amends: 389b1eceb9

Fixes: QTCREATORBUG-28312
Change-Id: Iecff3adeee8f8ce198c12289e51487a51178759e
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Alessandro Portale
2022-10-17 21:07:21 +02:00
parent 053990c357
commit 93dd15855e

View File

@@ -77,7 +77,7 @@ Core::GeneratedFiles JsonWizardScannerGenerator::fileList(Utils::MacroExpander *
[](const Utils::FilePath &filePath) { return int(filePath.path().count('/')); };
int minDepth = std::numeric_limits<int>::max();
for (auto it = result.begin(); it != result.end(); ++it) {
const Utils::FilePath relPath = projectDir.relativePath(it->filePath());
const Utils::FilePath relPath = it->filePath().relativePath(projectDir);
it->setBinary(binaryPattern.match(relPath.toString()).hasMatch());
bool found = ProjectManager::canOpenProjectForMimeType(Utils::mimeTypeForFile(relPath));
if (found) {
@@ -119,7 +119,7 @@ Core::GeneratedFiles JsonWizardScannerGenerator::scan(const Utils::FilePath &dir
const Utils::FilePaths entries = dir.dirEntries({{}, QDir::AllEntries | QDir::NoDotAndDotDot},
QDir::DirsLast | QDir::Name);
for (const Utils::FilePath &fi : entries) {
const Utils::FilePath relativePath = base.relativePath(fi);
const Utils::FilePath relativePath = fi.relativePath(base);
if (fi.isDir() && matchesSubdirectoryPattern(relativePath)) {
result += scan(fi, base);
} else {