mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 03:37:17 +02:00
fallback if local URL empty when loading default scripts
This commit is contained in:
parent
25bd6fa2c1
commit
eb033c797a
1 changed files with 35 additions and 32 deletions
|
@ -156,6 +156,8 @@ void ScriptsModel::reloadDefaultFiles() {
|
|||
void ScriptsModel::requestDefaultFiles(QString marker) {
|
||||
QUrl url(defaultScriptsLocation());
|
||||
|
||||
// targets that don't have a scripts folder in the appropriate location will have an empty URL here
|
||||
if (!url.isEmpty()) {
|
||||
if (url.isLocalFile()) {
|
||||
// if the url indicates a local directory, use QDirIterator
|
||||
QString localDir = expandScriptUrl(url).toLocalFile();
|
||||
|
@ -163,9 +165,9 @@ void ScriptsModel::requestDefaultFiles(QString marker) {
|
|||
if (localDir.endsWith("/")) {
|
||||
localDirPartCount--;
|
||||
}
|
||||
#ifdef Q_OS_WIN
|
||||
#ifdef Q_OS_WIN
|
||||
localDirPartCount++; // one for the drive letter
|
||||
#endif
|
||||
#endif
|
||||
QDirIterator it(localDir, QStringList() << "*.js", QDir::Files, QDirIterator::Subdirectories);
|
||||
while (it.hasNext()) {
|
||||
QUrl jsFullPath = QUrl::fromLocalFile(it.next());
|
||||
|
@ -190,6 +192,7 @@ void ScriptsModel::requestDefaultFiles(QString marker) {
|
|||
QNetworkReply* reply = networkAccessManager.get(request);
|
||||
connect(reply, SIGNAL(finished()), SLOT(downloadFinished()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ScriptsModel::downloadFinished() {
|
||||
|
|
Loading…
Reference in a new issue