forked from qt-creator/qt-creator
App: Use appInfo().paths
Change-Id: I4e23a1187ad7c13a60692917a21455b95adcbe98 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -176,37 +176,31 @@ static inline int askMsgSendFailed()
|
|||||||
QMessageBox::Retry);
|
QMessageBox::Retry);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline QStringList getPluginPaths()
|
static inline FilePaths getPluginPaths()
|
||||||
{
|
{
|
||||||
QStringList rc;
|
FilePaths rc;
|
||||||
rc << (QDir::cleanPath(QApplication::applicationDirPath()
|
rc << appInfo().plugins << appInfo().resources / "lua-plugins";
|
||||||
+ '/' + RELATIVE_PLUGIN_PATH))
|
|
||||||
<< (QDir::cleanPath(QApplication::applicationDirPath()
|
const auto version = [](int micro) {
|
||||||
+ '/' + RELATIVE_DATA_PATH + "/lua-plugins"));
|
return QString::number(IDE_VERSION_MAJOR) + '.' + QString::number(IDE_VERSION_MINOR) + '.'
|
||||||
|
+ QString::number(micro);
|
||||||
|
};
|
||||||
|
|
||||||
|
const int minPatchVersion = qMin(
|
||||||
|
IDE_VERSION_RELEASE,
|
||||||
|
QVersionNumber::fromString(Core::Constants::IDE_VERSION_COMPAT).microVersion());
|
||||||
|
|
||||||
// Local plugin path: <localappdata>/plugins/<ideversion>
|
// Local plugin path: <localappdata>/plugins/<ideversion>
|
||||||
// where <localappdata> is e.g.
|
// where <localappdata> is e.g.
|
||||||
// "%LOCALAPPDATA%\QtProject\qtcreator" on Windows Vista and later
|
// "%LOCALAPPDATA%\QtProject\qtcreator" on Windows Vista and later
|
||||||
// "$XDG_DATA_HOME/data/QtProject/qtcreator" or "~/.local/share/data/QtProject/qtcreator" on Linux
|
// "$XDG_DATA_HOME/data/QtProject/qtcreator" or "~/.local/share/data/QtProject/qtcreator" on Linux
|
||||||
// "~/Library/Application Support/QtProject/Qt Creator" on Mac
|
// "~/Library/Application Support/QtProject/Qt Creator" on Mac
|
||||||
QString pluginPath = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation);
|
const FilePath userPluginPath = appInfo().userPluginsRoot;
|
||||||
if (HostOsInfo::isAnyUnixHost() && !HostOsInfo::isMacHost())
|
|
||||||
pluginPath += QLatin1String("/data");
|
|
||||||
pluginPath += QLatin1Char('/')
|
|
||||||
+ QLatin1String(Core::Constants::IDE_SETTINGSVARIANT_STR)
|
|
||||||
+ QLatin1Char('/');
|
|
||||||
pluginPath += QLatin1String(HostOsInfo::isMacHost() ?
|
|
||||||
Core::Constants::IDE_DISPLAY_NAME :
|
|
||||||
Core::Constants::IDE_ID);
|
|
||||||
pluginPath += QLatin1String("/plugins/");
|
|
||||||
// Qt Creator X.Y.Z can load plugins from X.Y.(Z-1) etc, so add current and previous
|
// Qt Creator X.Y.Z can load plugins from X.Y.(Z-1) etc, so add current and previous
|
||||||
// patch versions
|
// patch versions
|
||||||
const QString minorVersion = QString::number(IDE_VERSION_MAJOR) + '.'
|
|
||||||
+ QString::number(IDE_VERSION_MINOR) + '.';
|
|
||||||
const int minPatchVersion
|
|
||||||
= qMin(IDE_VERSION_RELEASE,
|
|
||||||
QVersionNumber::fromString(Core::Constants::IDE_VERSION_COMPAT).microVersion());
|
|
||||||
for (int patchVersion = IDE_VERSION_RELEASE; patchVersion >= minPatchVersion; --patchVersion)
|
for (int patchVersion = IDE_VERSION_RELEASE; patchVersion >= minPatchVersion; --patchVersion)
|
||||||
rc.push_back(pluginPath + minorVersion + QString::number(patchVersion));
|
rc << userPluginPath / version(patchVersion);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -808,9 +802,10 @@ int main(int argc, char **argv)
|
|||||||
QNetworkProxyFactory::setUseSystemConfiguration(true);
|
QNetworkProxyFactory::setUseSystemConfiguration(true);
|
||||||
|
|
||||||
// Load
|
// Load
|
||||||
const QStringList pluginPaths = getPluginPaths() + installPluginPaths
|
const QStringList pluginPaths = installPluginPaths + options.customPluginPaths;
|
||||||
+ options.customPluginPaths;
|
PluginManager::setPluginPaths(
|
||||||
PluginManager::setPluginPaths(Utils::transform(pluginPaths, &FilePath::fromUserInput));
|
getPluginPaths() + Utils::transform(pluginPaths, &FilePath::fromUserInput));
|
||||||
|
|
||||||
QMap<QString, QString> foundAppOptions;
|
QMap<QString, QString> foundAppOptions;
|
||||||
if (pluginArguments.size() > 1) {
|
if (pluginArguments.size() > 1) {
|
||||||
QMap<QString, bool> appOptions;
|
QMap<QString, bool> appOptions;
|
||||||
|
Reference in New Issue
Block a user