core: reference scanned paths by QDir over QString
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:
parent
db1777c20b
commit
fc704e6b5d
2 changed files with 8 additions and 7 deletions
|
|
@ -19,12 +19,13 @@
|
|||
|
||||
QS_LOGGING_CATEGORY(logQmlScanner, "quickshell.qmlscanner", QtWarningMsg);
|
||||
|
||||
void QmlScanner::scanDir(const QString& path) {
|
||||
if (this->scannedDirs.contains(path)) return;
|
||||
this->scannedDirs.push_back(path);
|
||||
void QmlScanner::scanDir(const QDir& dir) {
|
||||
if (this->scannedDirs.contains(dir)) return;
|
||||
this->scannedDirs.push_back(dir);
|
||||
|
||||
const auto& path = dir.path();
|
||||
|
||||
qCDebug(logQmlScanner) << "Scanning directory" << path;
|
||||
auto dir = QDir(path);
|
||||
|
||||
struct Entry {
|
||||
QString name;
|
||||
|
|
@ -166,7 +167,7 @@ bool QmlScanner::scanQmlFile(const QString& path, bool& singleton, bool& interna
|
|||
auto currentdir = QDir(QFileInfo(path).absolutePath());
|
||||
|
||||
// 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) {
|
||||
QString ipath;
|
||||
|
|
|
|||
|
|
@ -16,10 +16,10 @@ public:
|
|||
QmlScanner() = default;
|
||||
QmlScanner(const QDir& rootPath): rootPath(rootPath) {}
|
||||
|
||||
void scanDir(const QString& path);
|
||||
void scanDir(const QDir& dir);
|
||||
void scanQmlRoot(const QString& path);
|
||||
|
||||
QVector<QString> scannedDirs;
|
||||
QVector<QDir> scannedDirs;
|
||||
QVector<QString> scannedFiles;
|
||||
QHash<QString, QString> fileIntercepts;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue