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
163163 while (it.hasNext()) {
164164 QString jsFullPath = it.next();
165165 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
166170 _treeNodes.append(new TreeNodeScript(jsPartialPath, jsFullPath, SCRIPT_ORIGIN_DEFAULT));
167171 }
168172 } else {
@@ -274,7 +278,13 @@ void ScriptsModel::reloadLocalFiles() { · 105 unmodified lines
274278 const QFileInfoList localFiles = _localDirectory.entryInfoList();
275279 for (int i = 0; i < localFiles.size(); i++) {
276280 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));
278288 }
279289 rebuildTree();
280290 endResetModel();