1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 10:46:35 +01:00

GreaseMonkey: Don't store absolute path to require scripts

This commit is contained in:
David Rosca 2017-04-19 13:25:46 +02:00
parent f57d6d0682
commit 84477aa2dc
2 changed files with 6 additions and 3 deletions

View File

@ -1,6 +1,6 @@
/* ============================================================
* GreaseMonkey plugin for QupZilla
* Copyright (C) 2012-2016 David Rosca <nowrep@gmail.com>
* Copyright (C) 2012-2017 David Rosca <nowrep@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -127,7 +127,7 @@ void GM_Downloader::requireDownloaded()
QSettings settings(m_manager->settinsPath() + QL1S("/greasemonkey/requires/requires.ini"), QSettings::IniFormat);
settings.beginGroup("Files");
settings.setValue(m_reply->request().url().toString(), fileName);
settings.setValue(m_reply->request().url().toString(), QFileInfo(fileName).fileName());
}
}

View File

@ -82,7 +82,10 @@ QString GM_Manager::requireScripts(const QStringList &urlList) const
foreach (const QString &url, urlList) {
if (settings.contains(url)) {
const QString fileName = settings.value(url).toString();
QString fileName = settings.value(url).toString();
if (!QFileInfo(fileName).isAbsolute()) {
fileName = m_settingsPath + QL1S("/greasemonkey/requires/") + fileName;
}
script.append(QzTools::readAllFileContents(fileName).trimmed() + '\n');
}
}