forked from qt-creator/qt-creator
JSON wizards: Don't add paths from environment over and over
It would add the paths from the environment variable again, each time the searchPaths are requested Change-Id: I2650ba832e23b5fcd6bfd363389e1eaf3beddb9d Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -505,10 +505,15 @@ static QStringList environmentTemplatesPaths()
|
|||||||
|
|
||||||
FilePaths &JsonWizardFactory::searchPaths()
|
FilePaths &JsonWizardFactory::searchPaths()
|
||||||
{
|
{
|
||||||
static FilePaths m_searchPaths = {Core::ICore::userResourcePath(WIZARD_PATH),
|
static FilePaths m_searchPaths;
|
||||||
|
static bool searchPathsInitialized = false;
|
||||||
|
if (!searchPathsInitialized) {
|
||||||
|
searchPathsInitialized = true;
|
||||||
|
m_searchPaths = {Core::ICore::userResourcePath(WIZARD_PATH),
|
||||||
Core::ICore::resourcePath(WIZARD_PATH)};
|
Core::ICore::resourcePath(WIZARD_PATH)};
|
||||||
for (const QString &environmentTemplateDirName : environmentTemplatesPaths())
|
for (const QString &environmentTemplateDirName : environmentTemplatesPaths())
|
||||||
m_searchPaths << FilePath::fromString(environmentTemplateDirName);
|
m_searchPaths << FilePath::fromString(environmentTemplateDirName);
|
||||||
|
}
|
||||||
|
|
||||||
return m_searchPaths;
|
return m_searchPaths;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user