core: reference scanned paths by QDir over QString
Some checks failed
Lint / Lint (push) Has been cancelled
Build / Nix (push) Has been cancelled
Build / Nix-1 (push) Has been cancelled
Build / Nix-2 (push) Has been cancelled
Build / Nix-3 (push) Has been cancelled
Build / Nix-4 (push) Has been cancelled
Build / Nix-5 (push) Has been cancelled
Build / Nix-6 (push) Has been cancelled
Build / Nix-7 (push) Has been cancelled
Build / Nix-8 (push) Has been cancelled
Build / Nix-9 (push) Has been cancelled
Build / Nix-10 (push) Has been cancelled
Build / Nix-11 (push) Has been cancelled
Build / Nix-12 (push) Has been cancelled
Build / Nix-13 (push) Has been cancelled
Build / Nix-14 (push) Has been cancelled
Build / Nix-15 (push) Has been cancelled
Build / Nix-16 (push) Has been cancelled
Build / Nix-17 (push) Has been cancelled
Build / Nix-18 (push) Has been cancelled
Build / Nix-19 (push) Has been cancelled
Build / Nix-20 (push) Has been cancelled
Build / Nix-21 (push) Has been cancelled
Build / Nix-22 (push) Has been cancelled
Build / Nix-23 (push) Has been cancelled
Build / Nix-24 (push) Has been cancelled
Build / Nix-25 (push) Has been cancelled
Build / Nix-26 (push) Has been cancelled
Build / Nix-27 (push) Has been cancelled
Build / Nix-28 (push) Has been cancelled
Build / Nix-29 (push) Has been cancelled
Build / Archlinux (push) Has been cancelled

Fixes a bug introduced in 3e2ce40 where a directory imported with a
"../name" path import would be passed to scanDir as ending in '/' which
created an invalid duplicate scan entry.
This commit is contained in:
outfoxxed 2025-10-31 00:56:30 -07:00
parent db1777c20b
commit fc704e6b5d
No known key found for this signature in database
GPG key ID: 4C88A185FB89301E
2 changed files with 8 additions and 7 deletions

View file

@ -19,12 +19,13 @@
QS_LOGGING_CATEGORY(logQmlScanner, "quickshell.qmlscanner", QtWarningMsg); QS_LOGGING_CATEGORY(logQmlScanner, "quickshell.qmlscanner", QtWarningMsg);
void QmlScanner::scanDir(const QString& path) { void QmlScanner::scanDir(const QDir& dir) {
if (this->scannedDirs.contains(path)) return; if (this->scannedDirs.contains(dir)) return;
this->scannedDirs.push_back(path); this->scannedDirs.push_back(dir);
const auto& path = dir.path();
qCDebug(logQmlScanner) << "Scanning directory" << path; qCDebug(logQmlScanner) << "Scanning directory" << path;
auto dir = QDir(path);
struct Entry { struct Entry {
QString name; QString name;
@ -166,7 +167,7 @@ bool QmlScanner::scanQmlFile(const QString& path, bool& singleton, bool& interna
auto currentdir = QDir(QFileInfo(path).absolutePath()); auto currentdir = QDir(QFileInfo(path).absolutePath());
// the root can never be a singleton so it dosent matter if we skip it // the root can never be a singleton so it dosent matter if we skip it
this->scanDir(currentdir.path()); this->scanDir(currentdir);
for (auto& import: imports) { for (auto& import: imports) {
QString ipath; QString ipath;

View file

@ -16,10 +16,10 @@ public:
QmlScanner() = default; QmlScanner() = default;
QmlScanner(const QDir& rootPath): rootPath(rootPath) {} QmlScanner(const QDir& rootPath): rootPath(rootPath) {}
void scanDir(const QString& path); void scanDir(const QDir& dir);
void scanQmlRoot(const QString& path); void scanQmlRoot(const QString& path);
QVector<QString> scannedDirs; QVector<QDir> scannedDirs;
QVector<QString> scannedFiles; QVector<QString> scannedFiles;
QHash<QString, QString> fileIntercepts; QHash<QString, QString> fileIntercepts;