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