History

new --scripts switch overrides default scripts location

David Kelly committed 9 years ago

Commit ff5b37c1 parent 34edd958 files · +81 −45Browse files

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

Unified · Split

libraries/script-engine/src/ScriptsModel.cpp+5−5
@@ -125,15 +125,15 @@ int ScriptsModel::columnCount(const QModelIndex& parent) const { · 124 unmodified lines
125 125
126void ScriptsModel::updateScriptsLocation(const QString& newPath) {126void ScriptsModel::updateScriptsLocation(const QString& newPath) {
127 _fsWatcher.removePath(_localDirectory.absolutePath());127 _fsWatcher.removePath(_localDirectory.absolutePath());
128 128
129 if (!newPath.isEmpty()) {129 if (!newPath.isEmpty()) {
130 _localDirectory.setPath(newPath);130 _localDirectory.setPath(newPath);
131 131
132 if (!_localDirectory.absolutePath().isEmpty()) {132 if (!_localDirectory.absolutePath().isEmpty()) {
133 _fsWatcher.addPath(_localDirectory.absolutePath());133 _fsWatcher.addPath(_localDirectory.absolutePath());
134 }134 }
135 }135 }
136 136
137 reloadLocalFiles();137 reloadLocalFiles();
138}138}
139 139
@@ -154,7 +154,7 @@ void ScriptsModel::reloadDefaultFiles() { · 14 unmodified lines
154}154}
155 155
156void ScriptsModel::requestDefaultFiles(QString marker) {156void ScriptsModel::requestDefaultFiles(QString marker) {
157 QUrl url(defaultScriptsLocation());157 QUrl url(PathUtils::defaultScriptsLocation());
158 158
159 // targets that don't have a scripts folder in the appropriate location will have an empty URL here159 // targets that don't have a scripts folder in the appropriate location will have an empty URL here
160 if (!url.isEmpty()) {160 if (!url.isEmpty()) {
@@ -244,7 +244,7 @@ bool ScriptsModel::parseXML(QByteArray xmlFile) { · 83 unmodified lines
244 lastKey = xml.text().toString();244 lastKey = xml.text().toString();
245 if (jsRegex.exactMatch(xml.text().toString())) {245 if (jsRegex.exactMatch(xml.text().toString())) {
246 QString localPath = lastKey.split("/").mid(1).join("/");246 QString localPath = lastKey.split("/").mid(1).join("/");
247 QUrl fullPath = defaultScriptsLocation();247 QUrl fullPath = PathUtils::defaultScriptsLocation();
248 fullPath.setPath(fullPath.path() + lastKey);248 fullPath.setPath(fullPath.path() + lastKey);
249 const QString fullPathStr = normalizeScriptURL(fullPath).toString();249 const QString fullPathStr = normalizeScriptURL(fullPath).toString();
250 _treeNodes.append(new TreeNodeScript(localPath, fullPathStr, SCRIPT_ORIGIN_DEFAULT));250 _treeNodes.append(new TreeNodeScript(localPath, fullPathStr, SCRIPT_ORIGIN_DEFAULT));