mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 06:10:52 +02:00
get this working on windows
This commit is contained in:
parent
bb43347599
commit
62372415be
3 changed files with 5 additions and 3 deletions
|
@ -51,7 +51,7 @@ QUrl normalizeScriptURL(const QUrl& rawScriptURL) {
|
||||||
#else
|
#else
|
||||||
// Force lowercase on file scripts because of drive letter weirdness.
|
// Force lowercase on file scripts because of drive letter weirdness.
|
||||||
if (rawScriptURL.isLocalFile()) {
|
if (rawScriptURL.isLocalFile()) {
|
||||||
fullNormal.setPath(fullNormal.path.toLower());
|
fullNormal.setPath(fullNormal.path().toLower());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
// if this url is something "beneath" the default script url, replace the local path with ~
|
// if this url is something "beneath" the default script url, replace the local path with ~
|
||||||
|
|
|
@ -162,10 +162,12 @@ void ScriptsModel::requestDefaultFiles(QString marker) {
|
||||||
// QString localDir = url.toLocalFile() + "/scripts";
|
// QString localDir = url.toLocalFile() + "/scripts";
|
||||||
QString localDir = expandScriptUrl(url).toLocalFile() + "/scripts";
|
QString localDir = expandScriptUrl(url).toLocalFile() + "/scripts";
|
||||||
int localDirPartCount = localDir.split("/").size();
|
int localDirPartCount = localDir.split("/").size();
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
localDirPartCount++; // one for the drive letter
|
||||||
|
#endif
|
||||||
QDirIterator it(localDir, QStringList() << "*.js", QDir::Files, QDirIterator::Subdirectories);
|
QDirIterator it(localDir, QStringList() << "*.js", QDir::Files, QDirIterator::Subdirectories);
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
QUrl jsFullPath = QUrl::fromLocalFile(it.next());
|
QUrl jsFullPath = QUrl::fromLocalFile(it.next());
|
||||||
// QString jsPartialPath = jsFullPath.path().mid(localDir.length() + 1); // + 1 to skip a separator
|
|
||||||
QString jsPartialPath = jsFullPath.path().split("/").mid(localDirPartCount).join("/");
|
QString jsPartialPath = jsFullPath.path().split("/").mid(localDirPartCount).join("/");
|
||||||
jsFullPath = normalizeScriptURL(jsFullPath);
|
jsFullPath = normalizeScriptURL(jsFullPath);
|
||||||
_treeNodes.append(new TreeNodeScript(jsPartialPath, jsFullPath.toString(), SCRIPT_ORIGIN_DEFAULT));
|
_treeNodes.append(new TreeNodeScript(jsPartialPath, jsFullPath.toString(), SCRIPT_ORIGIN_DEFAULT));
|
||||||
|
|
|
@ -57,7 +57,7 @@ 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());
|
||||||
#elif defined(Q_OS_OSX)
|
#elif defined(Q_OS_OSX)
|
||||||
return QUrl(("file://" + QCoreApplication::applicationDirPath() + "/../..").toLower());
|
return QUrl(("file://" + QCoreApplication::applicationDirPath() + "/../..").toLower());
|
||||||
#else
|
#else
|
||||||
|
|
Loading…
Reference in a new issue