Commit 8d70ab27 authored by Christian Kamm's avatar Christian Kamm
Browse files

QmlJS: Clean paths in the Snapshot.

To solve import resolution issues on windows.

Reviewed-by: Roberto Raggi
parent 80fa3216
......@@ -47,10 +47,10 @@ Document::Document(const QString &fileName)
, _isQmlDocument(false)
, _documentRevision(0)
, _parsedCorrectly(false)
, _fileName(fileName)
, _fileName(QDir::cleanPath(fileName))
{
QFileInfo fileInfo(fileName);
_path = fileInfo.absolutePath();
_path = QDir::cleanPath(fileInfo.absolutePath());
// ### Should use mime type
if (fileInfo.suffix() == QLatin1String("qml")
......@@ -258,7 +258,7 @@ void Snapshot::insert(const Document::Ptr &document)
void Snapshot::insertLibraryInfo(const QString &path, const LibraryInfo &info)
{
_libraries.insert(path, info);
_libraries.insert(QDir::cleanPath(path), info);
}
Document::Ptr Snapshot::documentFromSource(const QString &code,
......@@ -314,3 +314,18 @@ QMap<QString, Document::Ptr> Snapshot::componentsDefinedByImportedDocuments(cons
return result;
}
Document::Ptr Snapshot::document(const QString &fileName) const
{
return _documents.value(QDir::cleanPath(fileName));
}
QList<Document::Ptr> Snapshot::documentsInDirectory(const QString &path) const
{
return _documentsByPath.values(QDir::cleanPath(path));
}
LibraryInfo Snapshot::libraryInfo(const QString &path) const
{
return _libraries.value(QDir::cleanPath(path));
}
......@@ -149,14 +149,9 @@ public:
void insert(const Document::Ptr &document);
void insertLibraryInfo(const QString &path, const LibraryInfo &info);
Document::Ptr document(const QString &fileName) const
{ return _documents.value(fileName); }
QList<Document::Ptr> documentsInDirectory(const QString &path) const
{ return _documentsByPath.values(path); }
LibraryInfo libraryInfo(const QString &path) const
{ return _libraries.value(path); }
Document::Ptr document(const QString &fileName) const;
QList<Document::Ptr> documentsInDirectory(const QString &path) const;
LibraryInfo libraryInfo(const QString &path) const;
Document::Ptr documentFromSource(const QString &code,
const QString &fileName) const;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment