aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sources/shiboken2/ApiExtractor/typedatabase.cpp4
-rw-r--r--sources/shiboken2/ApiExtractor/typedatabase.h3
-rw-r--r--sources/shiboken2/ApiExtractor/typesystem.cpp5
3 files changed, 7 insertions, 5 deletions
diff --git a/sources/shiboken2/ApiExtractor/typedatabase.cpp b/sources/shiboken2/ApiExtractor/typedatabase.cpp
index be0d987a4..4a96240c4 100644
--- a/sources/shiboken2/ApiExtractor/typedatabase.cpp
+++ b/sources/shiboken2/ApiExtractor/typedatabase.cpp
@@ -451,14 +451,14 @@ bool TypeDatabase::isSuppressedWarning(const QString& s) const
return false;
}
-QString TypeDatabase::modifiedTypesystemFilepath(const QString& tsFile) const
+QString TypeDatabase::modifiedTypesystemFilepath(const QString& tsFile, bool stripPath) const
{
const QFileInfo tsFi(tsFile);
if (tsFi.isAbsolute()) // No point in further lookups
return tsFi.absoluteFilePath();
if (tsFi.isFile()) // Make path absolute
return tsFi.absoluteFilePath();
- const QString fileName = tsFi.fileName();
+ const QString fileName = stripPath ? tsFi.fileName() : tsFile;
for (const QString &path : m_typesystemPaths) {
const QFileInfo fi(path + QLatin1Char('/') + fileName);
if (fi.isFile())
diff --git a/sources/shiboken2/ApiExtractor/typedatabase.h b/sources/shiboken2/ApiExtractor/typedatabase.h
index 603a43ba4..63f4cc73d 100644
--- a/sources/shiboken2/ApiExtractor/typedatabase.h
+++ b/sources/shiboken2/ApiExtractor/typedatabase.h
@@ -154,12 +154,13 @@ public:
void setDropTypeEntries(QStringList dropTypeEntries);
+ QString modifiedTypesystemFilepath(const QString &tsFile, bool stripPath = true) const;
+
#ifndef QT_NO_DEBUG_STREAM
void formatDebug(QDebug &d) const;
#endif
private:
TypeEntryList findTypes(const QString &name) const;
- QString modifiedTypesystemFilepath(const QString &tsFile) const;
bool m_suppressWarnings;
TypeEntryHash m_entries;
diff --git a/sources/shiboken2/ApiExtractor/typesystem.cpp b/sources/shiboken2/ApiExtractor/typesystem.cpp
index 6ba609333..9c80a6c0b 100644
--- a/sources/shiboken2/ApiExtractor/typesystem.cpp
+++ b/sources/shiboken2/ApiExtractor/typesystem.cpp
@@ -1947,8 +1947,9 @@ bool Handler::startElement(const QStringRef &n, const QXmlStreamAttributes &atts
if (m_generate != TypeEntry::GenerateForSubclass &&
m_generate != TypeEntry::GenerateNothing &&
!file_name.isEmpty()) {
- if (QFile::exists(file_name)) {
- QFile codeFile(file_name);
+ const QString resolved = m_database->modifiedTypesystemFilepath(file_name, false);
+ if (QFile::exists(resolved)) {
+ QFile codeFile(resolved);
if (codeFile.open(QIODevice::Text | QIODevice::ReadOnly)) {
QString content = QLatin1String("// ========================================================================\n"
"// START of custom code block [file: ");