History

lowercase filenames/paths before they go into _treeNodes to avoid scripts being unstoppable

Seth Alves committed 10 years ago

Commit 2ad02941 parent 51cf8541 file · +11 −1Browse files

Showing the changes to libraries/script-engine/src/ScriptsModel.cpp (1 of 1 file). Show all

Unified · Split

libraries/script-engine/src/ScriptsModel.cpp+11−1
@@ -163,6 +163,10 @@ void ScriptsModel::requestDefaultFiles(QString marker) { · 162 unmodified lines
163 while (it.hasNext()) {163 while (it.hasNext()) {
164 QString jsFullPath = it.next();164 QString jsFullPath = it.next();
165 QString jsPartialPath = jsFullPath.mid(localDir.length() + 1); // + 1 to skip a separator165 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
166 _treeNodes.append(new TreeNodeScript(jsPartialPath, jsFullPath, SCRIPT_ORIGIN_DEFAULT));170 _treeNodes.append(new TreeNodeScript(jsPartialPath, jsFullPath, SCRIPT_ORIGIN_DEFAULT));
167 }171 }
168 } else {172 } else {
@@ -274,7 +278,13 @@ void ScriptsModel::reloadLocalFiles() { · 105 unmodified lines
274 const QFileInfoList localFiles = _localDirectory.entryInfoList();278 const QFileInfoList localFiles = _localDirectory.entryInfoList();
275 for (int i = 0; i < localFiles.size(); i++) {279 for (int i = 0; i < localFiles.size(); i++) {
276 QFileInfo file = localFiles[i];280 QFileInfo file = localFiles[i];
277 _treeNodes.append(new TreeNodeScript(file.fileName(), file.absoluteFilePath(), SCRIPT_ORIGIN_LOCAL));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
287 _treeNodes.append(new TreeNodeScript(fileName, absPath, SCRIPT_ORIGIN_LOCAL));
278 }288 }
279 rebuildTree();289 rebuildTree();
280 endResetModel();290 endResetModel();