Skip to content

Commit

Permalink
JSON wizards: Don't add paths from environment over and over
Browse files Browse the repository at this point in the history
It would add the paths from the environment variable again, each time
the searchPaths are requested

Change-Id: I2650ba832e23b5fcd6bfd363389e1eaf3beddb9d
Reviewed-by: Christian Stenger <[email protected]>
Reviewed-by: <[email protected]>
  • Loading branch information
e4z9 committed Nov 18, 2022
1 parent c18d877 commit f5efd9a
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/plugins/projectexplorer/jsonwizard/jsonwizardfactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -505,10 +505,15 @@ static QStringList environmentTemplatesPaths()

FilePaths &JsonWizardFactory::searchPaths()
{
static FilePaths m_searchPaths = {Core::ICore::userResourcePath(WIZARD_PATH),
Core::ICore::resourcePath(WIZARD_PATH)};
for (const QString &environmentTemplateDirName : environmentTemplatesPaths())
m_searchPaths << FilePath::fromString(environmentTemplateDirName);
static FilePaths m_searchPaths;
static bool searchPathsInitialized = false;
if (!searchPathsInitialized) {
searchPathsInitialized = true;
m_searchPaths = {Core::ICore::userResourcePath(WIZARD_PATH),
Core::ICore::resourcePath(WIZARD_PATH)};
for (const QString &environmentTemplateDirName : environmentTemplatesPaths())
m_searchPaths << FilePath::fromString(environmentTemplateDirName);
}

return m_searchPaths;
}
Expand Down

0 comments on commit f5efd9a

Please sign in to comment.