diff options
author | Antti Kokko <antti.kokko@qt.io> | 2020-06-25 07:32:53 +0300 |
---|---|---|
committer | Antti Kokko <antti.kokko@qt.io> | 2020-06-25 07:32:53 +0300 |
commit | dd9baa255af6aff800e536781bce369fcc8a3547 (patch) | |
tree | 224c0d11aa0e82eb609bcff0eacc1d42b95604f9 /src/runtimerender/graphobjects/Qt3DSRenderDynamicObject.cpp | |
parent | 02e4d56d055d73340d3af1257b908a52aecc320f (diff) | |
parent | 1c2f256c2afd320bec7e94bfc94760892d6fc9e8 (diff) |
Merge branch '2.7'
Change-Id: I72499b82b0238c09486177f7c022f5d27896a2c8
Diffstat (limited to 'src/runtimerender/graphobjects/Qt3DSRenderDynamicObject.cpp')
-rw-r--r-- | src/runtimerender/graphobjects/Qt3DSRenderDynamicObject.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/runtimerender/graphobjects/Qt3DSRenderDynamicObject.cpp b/src/runtimerender/graphobjects/Qt3DSRenderDynamicObject.cpp index 1dd352c..8e927fe 100644 --- a/src/runtimerender/graphobjects/Qt3DSRenderDynamicObject.cpp +++ b/src/runtimerender/graphobjects/Qt3DSRenderDynamicObject.cpp @@ -125,7 +125,25 @@ void SDynamicObject::SetStrPropertyValueT(dynamic::SPropertyDefinition &inDefini if (inProjectDir == NULL) inProjectDir = ""; if (CFileTools::RequiresCombineBaseAndRelative(inValue)) { - QString path = QDir(inProjectDir).cleanPath(inValue); + QString value(QDir::cleanPath(inValue)); + QString projectDir(inProjectDir); + QString path = value; + + bool tryResolveRelativePath = !projectDir.startsWith(QStringLiteral(":/")); + if (tryResolveRelativePath) + path.prepend(projectDir + QChar('/')); + + if (tryResolveRelativePath) { + bool exists = QFileInfo(path).exists(); + if (!exists && value.startsWith("../")) { + QString tryPath = projectDir + QChar('/') + value.right(value.size() - 3); + exists = QFileInfo(tryPath).exists(); + if (exists) + path = tryPath; + else + path = value; // reset back to initial value if resolve failed + } + } ioWorkspace.assign(path.toLatin1().constData()); SetPropertyValueT(inDefinition, inStrTable.RegisterStr(ioWorkspace.c_str())); // We also adjust the image path in the definition |