Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 1 file). Show all
Unified · Split
| @@ -428,10 +428,7 @@ QString ScriptEngine::getFilename() const { · 427 unmodified lines | |||
| 428 | bool ScriptEngine::hasValidScriptSuffix(const QString& scriptFileName) { | 428 | bool ScriptEngine::hasValidScriptSuffix(const QString& scriptFileName) { |
| 429 | QFileInfo fileInfo(scriptFileName); | 429 | QFileInfo fileInfo(scriptFileName); |
| 430 | QString scriptSuffixToLower = fileInfo.completeSuffix().toLower(); | 430 | QString scriptSuffixToLower = fileInfo.completeSuffix().toLower(); |
| 431 | if (scriptSuffixToLower == "js" || scriptSuffixToLower == "json") { | 431 | return ((scriptSuffixToLower == "js") || (scriptSuffixToLower == "json")); |
| 432 | return true; | ||
| 433 | } | ||
| 434 | return false; | ||
| 435 | } | 432 | } |
| 436 | 433 | ||
| 437 | void ScriptEngine::loadURL(const QUrl& scriptURL, bool reload) { | 434 | void ScriptEngine::loadURL(const QUrl& scriptURL, bool reload) { |
| @@ -443,9 +440,10 @@ void ScriptEngine::loadURL(const QUrl& scriptURL, bool reload) { · 5 unmodified lines | |||
| 443 | _fileNameString = url.toString(); | 440 | _fileNameString = url.toString(); |
| 444 | _isReloading = reload; | 441 | _isReloading = reload; |
| 445 | 442 | ||
| 446 | // Check that script is an actual script | 443 | // Check that script has a supported file extension |
| 447 | if (!hasValidScriptSuffix(_fileNameString)) { | 444 | if (!hasValidScriptSuffix(_fileNameString)) { |
| 448 | qCDebug(scriptengine) << "File extension of file: " + _fileNameString + " is not a currently supported script type"; | 445 | scriptErrorMessage("File extension of file: " + _fileNameString + " is not a currently supported script type"); |
| 446 | emit errorLoadingScript(_fileNameString); | ||
| 449 | return; | 447 | return; |
| 450 | } | 448 | } |
| 451 | 449 | ||