include script in default script location

This commit is contained in:
Seth Alves 2016-04-01 10:50:22 -07:00
parent 5a665f9aef
commit 0f288247a7
3 changed files with 6 additions and 8 deletions

View file

@ -251,7 +251,7 @@ static const QString SETTINGS_KEY = "Settings";
void ScriptEngines::loadDefaultScripts() {
QUrl defaultScriptsLoc = defaultScriptsLocation();
defaultScriptsLoc.setPath(defaultScriptsLoc.path() + "/scripts/defaultScripts.js");
defaultScriptsLoc.setPath(defaultScriptsLoc.path() + "/defaultScripts.js");
loadScript(defaultScriptsLoc.toString());
}

View file

@ -25,7 +25,6 @@
#define __STR1__(x) __STR2__(x)
#define __LOC__ __FILE__ "(" __STR1__(__LINE__) ") : Warning Msg: "
static const QString MODELS_LOCATION = "scripts/";
static const QString PREFIX_PARAMETER_NAME = "prefix";
static const QString MARKER_PARAMETER_NAME = "marker";
static const QString IS_TRUNCATED_NAME = "IsTruncated";
@ -159,8 +158,7 @@ void ScriptsModel::requestDefaultFiles(QString marker) {
if (url.isLocalFile()) {
// if the url indicates a local directory, use QDirIterator
// QString localDir = url.toLocalFile() + "/scripts";
QString localDir = expandScriptUrl(url).toLocalFile() + "/scripts";
QString localDir = expandScriptUrl(url).toLocalFile();
int localDirPartCount = localDir.split("/").size();
#ifdef Q_OS_WIN
localDirPartCount++; // one for the drive letter
@ -176,7 +174,7 @@ void ScriptsModel::requestDefaultFiles(QString marker) {
} else {
// the url indicates http(s), use QNetworkRequest
QUrlQuery query;
query.addQueryItem(PREFIX_PARAMETER_NAME, MODELS_LOCATION);
query.addQueryItem(PREFIX_PARAMETER_NAME, ".");
if (!marker.isEmpty()) {
query.addQueryItem(MARKER_PARAMETER_NAME, marker);
}

View file

@ -57,11 +57,11 @@ QString findMostRecentFileExtension(const QString& originalFileName, QVector<QSt
QUrl defaultScriptsLocation() {
#ifdef Q_OS_WIN
return QUrl(("file:///" + QCoreApplication::applicationDirPath()).toLower());
return QUrl(("file:///" + QCoreApplication::applicationDirPath()).toLower() + "/scripts");
#elif defined(Q_OS_OSX)
return QUrl(("file://" + QCoreApplication::applicationDirPath() + "/../Resources").toLower());
return QUrl(("file://" + QCoreApplication::applicationDirPath() + "/../Resources/scripts").toLower());
#else
// return "http://s3.amazonaws.com/hifi-public";
return QUrl("file://" + QCoreApplication::applicationDirPath());
return QUrl("file://" + QCoreApplication::applicationDirPath() + "/scripts");
#endif
}