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 | 428 | bool ScriptEngine::hasValidScriptSuffix(const QString& scriptFileName) { |
| 429 | 429 | QFileInfo fileInfo(scriptFileName); |
| 430 | 430 | QString scriptSuffixToLower = fileInfo.completeSuffix().toLower(); |
| 431 | − if (scriptSuffixToLower == "js" || scriptSuffixToLower == "json") { | |
| 432 | − return true; | |
| 433 | − } | |
| 434 | − return false; | |
| 431 | + return ((scriptSuffixToLower == "js") || (scriptSuffixToLower == "json")); | |
| 435 | 432 | } |
| 436 | 433 | |
| 437 | 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 | 440 | _fileNameString = url.toString(); |
| 444 | 441 | _isReloading = reload; |
| 445 | 442 | |
| 446 | − // Check that script is an actual script | |
| 443 | + // Check that script has a supported file extension | |
| 447 | 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 | 447 | return; |
| 450 | 448 | } |
| 451 | 449 | |