Showing the changes to libraries/script-engine/src/ScriptsModel.cpp (1 of 4 files). Show all
Unified · Split
| @@ -161,12 +161,8 @@ void ScriptsModel::requestDefaultFiles(QString marker) { · 160 unmodified lines | ||
| 161 | 161 | QString localDir = url.toLocalFile() + "/scripts"; |
| 162 | 162 | QDirIterator it(localDir, QStringList() << "*.js", QDir::Files, QDirIterator::Subdirectories); |
| 163 | 163 | while (it.hasNext()) { |
| 164 | − QString jsFullPath = it.next(); | |
| 165 | − QString jsPartialPath = jsFullPath.mid(localDir.length() + 1); // + 1 to skip a separator | |
| 166 | − #if defined(Q_OS_WIN) || defined(Q_OS_OSX) | |
| 167 | − jsFullPath = jsFullPath.toLower(); | |
| 168 | − jsPartialPath = jsPartialPath.toLower(); | |
| 169 | − #endif | |
| 164 | + QString jsFullPath = normalizeScriptUrl(it.next()); | |
| 165 | + QString jsPartialPath = normalizeScriptUrl(jsFullPath.mid(localDir.length() + 1)); // + 1 to skip a separator | |
| 170 | 166 | _treeNodes.append(new TreeNodeScript(jsPartialPath, jsFullPath, SCRIPT_ORIGIN_DEFAULT)); |
| 171 | 167 | } |
| 172 | 168 | } else { |
| @@ -231,7 +227,7 @@ bool ScriptsModel::parseXML(QByteArray xmlFile) { · 58 unmodified lines | ||
| 231 | 227 | while (!(xml.tokenType() == QXmlStreamReader::EndElement && xml.name() == CONTAINER_NAME)) { |
| 232 | 228 | if (xml.tokenType() == QXmlStreamReader::StartElement && xml.name() == KEY_NAME) { |
| 233 | 229 | xml.readNext(); |
| 234 | − lastKey = xml.text().toString(); | |
| 230 | + lastKey = normalizeScriptUrl(xml.text().toString()); | |
| 235 | 231 | if (jsRegex.exactMatch(xml.text().toString())) { |
| 236 | 232 | _treeNodes.append(new TreeNodeScript(lastKey.mid(MODELS_LOCATION.length()), |
| 237 | 233 | defaultScriptsLocation() + "/" + lastKey, |
| @@ -278,12 +274,8 @@ void ScriptsModel::reloadLocalFiles() { · 40 unmodified lines | ||
| 278 | 274 | const QFileInfoList localFiles = _localDirectory.entryInfoList(); |
| 279 | 275 | for (int i = 0; i < localFiles.size(); i++) { |
| 280 | 276 | QFileInfo file = localFiles[i]; |
| 281 | − QString fileName = file.fileName(); | |
| 282 | − QString absPath = file.absoluteFilePath(); | |
| 283 | − #if defined(Q_OS_WIN) || defined(Q_OS_OSX) | |
| 284 | − fileName = fileName.toLower(); | |
| 285 | − absPath = absPath.toLower(); | |
| 286 | − #endif | |
| 277 | + QString fileName = normalizeScriptUrl(file.fileName()); | |
| 278 | + QString absPath = normalizeScriptUrl(file.absoluteFilePath()); | |
| 287 | 279 | _treeNodes.append(new TreeNodeScript(fileName, absPath, SCRIPT_ORIGIN_LOCAL)); |
| 288 | 280 | } |
| 289 | 281 | rebuildTree(); |
| @@ -310,7 +302,7 @@ void ScriptsModel::rebuildTree() { · 20 unmodified lines | ||
| 310 | 302 | for (pathIterator = pathList.constBegin(); pathIterator != pathList.constEnd(); ++pathIterator) { |
| 311 | 303 | hash.append(*pathIterator + "/"); |
| 312 | 304 | if (!folders.contains(hash)) { |
| 313 | − folders[hash] = new TreeNodeFolder(*pathIterator, parent); | |
| 305 | + folders[hash] = new TreeNodeFolder(normalizeScriptUrl(*pathIterator), parent); | |
| 314 | 306 | } |
| 315 | 307 | parent = folders[hash]; |
| 316 | 308 | } |