Showing the changes to libraries/script-engine/src/ScriptsModel.cpp (1 of 3 files). Show all
Unified · Split
| @@ -158,13 +158,13 @@ void ScriptsModel::requestDefaultFiles(QString marker) { · 157 unmodified lines | ||
| 158 | 158 | QUrl url(defaultScriptsLocation()); |
| 159 | 159 | |
| 160 | 160 | if (url.isLocalFile()) { |
| 161 | − // QDirIterator it(url.toLocalFile(), QStringList() << "*.js", QDir::Files, QDirIterator::Subdirectories); | |
| 162 | − // while (it.hasNext()) { | |
| 163 | − // QString jsFile = it.next();; | |
| 164 | − // _treeNodes.append(new TreeNodeScript(lastKey.mid(MODELS_LOCATION.length()), | |
| 165 | − // defaultScriptsLocation() + "/" + jsFile, | |
| 166 | − // SCRIPT_ORIGIN_DEFAULT)); | |
| 167 | − // } | |
| 161 | + QString localDir = url.toLocalFile() + "/scripts"; | |
| 162 | + QDirIterator it(localDir, QStringList() << "*.js", QDir::Files, QDirIterator::Subdirectories); | |
| 163 | + while (it.hasNext()) { | |
| 164 | + QString jsFullPath = it.next(); | |
| 165 | + QString jsPartialPath = jsFullPath.mid(localDir.length() + 1); // + 1 to skip a separator | |
| 166 | + _treeNodes.append(new TreeNodeScript(jsPartialPath, jsFullPath, SCRIPT_ORIGIN_DEFAULT)); | |
| 167 | + } | |
| 168 | 168 | } else { |
| 169 | 169 | QUrlQuery query; |
| 170 | 170 | query.addQueryItem(PREFIX_PARAMETER_NAME, MODELS_LOCATION); |