firstTime = false;
}
- qRegisterMetaType<QVariant>("QVariant");
- qRegisterMetaType<QQmlScriptString>("QQmlScriptString");
- qRegisterMetaType<QJSValue>("QJSValue");
- qRegisterMetaType<QQmlComponent::Status>("QQmlComponent::Status");
- qRegisterMetaType<QList<QObject*> >("QList<QObject*>");
- qRegisterMetaType<QList<int> >("QList<int>");
- qRegisterMetaType<QQmlV8Handle>("QQmlV8Handle");
+ qRegisterMetaType<QVariant>();
+ qRegisterMetaType<QQmlScriptString>();
+ qRegisterMetaType<QJSValue>();
+ qRegisterMetaType<QQmlComponent::Status>();
+ qRegisterMetaType<QList<QObject*> >();
+ qRegisterMetaType<QList<int> >();
+ qRegisterMetaType<QQmlV8Handle>();
v8engine()->setEngine(q);
return typeLoader.isScriptLoaded(url);
}
-bool QQml_isFileCaseCorrect(const QString &fileName)
+bool QQml_isFileCaseCorrect(const QString &fileName, int lengthIn /* = -1 */)
{
#if defined(Q_OS_MAC) || defined(Q_OS_WIN)
QFileInfo info(fileName);
const int absoluteLength = absolute.length();
const int canonicalLength = canonical.length();
- const int length = qMin(absoluteLength, canonicalLength);
+ int length = qMin(absoluteLength, canonicalLength);
+ if (lengthIn >= 0) {
+ length = qMin(lengthIn, length);
+ } else {
+ // No length given: Limit to file name. Do not trigger
+ // on drive letters or folder names.
+ int lastSlash = absolute.lastIndexOf(QLatin1Char('/'));
+ if (lastSlash < 0)
+ lastSlash = absolute.lastIndexOf(QLatin1Char('\\'));
+ if (lastSlash >= 0) {
+ const int fileNameLength = absoluteLength - 1 - lastSlash;
+ length = qMin(length, fileNameLength);
+ }
+ }
+
for (int ii = 0; ii < length; ++ii) {
const QChar &a = absolute.at(absoluteLength - 1 - ii);
const QChar &c = canonical.at(canonicalLength - 1 - ii);
return false;
}
#else
+ Q_UNUSED(lengthIn)
Q_UNUSED(fileName)
#endif
return true;