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() { void ScriptEngines::loadDefaultScripts() {
QUrl defaultScriptsLoc = defaultScriptsLocation(); QUrl defaultScriptsLoc = defaultScriptsLocation();
defaultScriptsLoc.setPath(defaultScriptsLoc.path() + "/scripts/defaultScripts.js"); defaultScriptsLoc.setPath(defaultScriptsLoc.path() + "/defaultScripts.js");
loadScript(defaultScriptsLoc.toString()); loadScript(defaultScriptsLoc.toString());
} }

View file

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

View file

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