fix display of path of selected file in running-scripts window

This commit is contained in:
Seth Alves 2016-04-01 12:05:49 -07:00
parent 35affe26e3
commit 56b84b3106
2 changed files with 1 additions and 32 deletions
libraries/script-engine/src

View file

@ -44,21 +44,9 @@ ScriptEngines::ScriptEngines()
QUrl normalizeScriptURL(const QUrl& rawScriptURL) {
if (rawScriptURL.scheme() == "file") {
qDebug() << "+";
qDebug() << "+";
qDebug() << "+";
QUrl fullNormal = rawScriptURL;
QUrl defaultScriptLoc = defaultScriptsLocation();
// #ifdef Q_OS_LINUX
// #else
// // Force lowercase on file scripts because of drive letter weirdness.
// if (rawScriptURL.isLocalFile()) {
// fullNormal.setPath(fullNormal.path()); // .toLower());
// }
// #endif
// if this url is something "beneath" the default script url, replace the local path with ~
if (fullNormal.scheme() == defaultScriptLoc.scheme() &&
fullNormal.host() == defaultScriptLoc.host() &&
@ -76,35 +64,20 @@ QUrl normalizeScriptURL(const QUrl& rawScriptURL) {
QUrl expandScriptUrl(const QUrl& rawScriptURL) {
QUrl normalizedScriptURL = normalizeScriptURL(rawScriptURL);
qDebug() << "expandScriptUrl in = " << rawScriptURL;
if (normalizedScriptURL.scheme() == "http" ||
normalizedScriptURL.scheme() == "https" ||
normalizedScriptURL.scheme() == "atp") {
qDebug() << "expandScriptUrl out(net) = " << normalizedScriptURL;
return normalizedScriptURL;
} else if (normalizedScriptURL.scheme() == "file") {
if (normalizedScriptURL.path().startsWith("/~/")) {
QUrl url = normalizedScriptURL;
qDebug() << "in expand, normalizedScriptURL = " << normalizedScriptURL;
QStringList splitPath = url.path().split("/");
QUrl defaultScriptsLoc = defaultScriptsLocation();
url.setPath(defaultScriptsLoc.path() + "/" + splitPath.mid(2).join("/")); // 2 to skip the slashes in /~/
qDebug() << "expandScriptUrl out(file 0) = " << url;
return url;
}
qDebug() << "expandScriptUrl out(file 1) = " << normalizedScriptURL;
return normalizedScriptURL;
} else {
qDebug() << "expandScriptUrl out(bad scheme) = " << normalizedScriptURL;
return QUrl("");
}
}

View file

@ -40,7 +40,7 @@ TreeNodeBase::TreeNodeBase(TreeNodeFolder* parent, const QString& name, TreeNode
TreeNodeScript::TreeNodeScript(const QString& localPath, const QString& fullPath, ScriptOrigin origin) :
TreeNodeBase(NULL, localPath.split("/").last(), TREE_NODE_TYPE_SCRIPT),
_localPath(localPath),
_fullPath(fullPath),
_fullPath(expandScriptUrl(QUrl(fullPath)).toString()),
_origin(origin) {
};
@ -163,10 +163,6 @@ void ScriptsModel::requestDefaultFiles(QString marker) {
if (localDir.endsWith("/")) {
localDirPartCount--;
}
qDebug() << "|";
qDebug() << "|";
qDebug() << "|";
qDebug() << localDir;
#ifdef Q_OS_WIN
localDirPartCount++; // one for the drive letter
#endif