1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Fixed the use of the dontRescanIfAlreadyInList parameter in PluginDirectoryScanner::scanNextFile()

This commit is contained in:
jules 2017-04-12 14:49:08 +01:00
parent f19390b531
commit 6c7bb37720
2 changed files with 11 additions and 20 deletions

View file

@ -39,7 +39,6 @@ PluginDirectoryScanner::PluginDirectoryScanner (KnownPluginList& listToAddTo,
: list (listToAddTo),
format (formatToLookFor),
deadMansPedalFile (deadMansPedal),
progress (0),
allowAsync (allowPluginsWhichRequireAsynchronousInstantiation)
{
directoriesToSearch.removeRedundantPaths();
@ -48,16 +47,10 @@ PluginDirectoryScanner::PluginDirectoryScanner (KnownPluginList& listToAddTo,
// If any plugins have crashed recently when being loaded, move them to the
// end of the list to give the others a chance to load correctly..
const StringArray crashedPlugins (readDeadMansPedalFile (deadMansPedalFile));
for (int i = 0; i < crashedPlugins.size(); ++i)
{
const String f = crashedPlugins[i];
for (auto& crashed : readDeadMansPedalFile (deadMansPedalFile))
for (int j = filesOrIdentifiersToScan.size(); --j >= 0;)
if (f == filesOrIdentifiersToScan[j])
if (crashed == filesOrIdentifiersToScan[j])
filesOrIdentifiersToScan.move (j, -1);
}
applyBlacklistingsFromDeadMansPedal (listToAddTo, deadMansPedalFile);
nextIndex.set (filesOrIdentifiersToScan.size());
@ -79,23 +72,23 @@ void PluginDirectoryScanner::updateProgress()
progress = (1.0f - nextIndex.get() / (float) filesOrIdentifiersToScan.size());
}
bool PluginDirectoryScanner::scanNextFile (const bool dontRescanIfAlreadyInList,
bool PluginDirectoryScanner::scanNextFile (bool dontRescanIfAlreadyInList,
String& nameOfPluginBeingScanned)
{
const int index = --nextIndex;
if (index >= 0)
{
const String file (filesOrIdentifiersToScan [index]);
auto file = filesOrIdentifiersToScan [index];
if (file.isNotEmpty() && ! list.isListingUpToDate (file, format))
if (file.isNotEmpty() && ! (dontRescanIfAlreadyInList && list.isListingUpToDate (file, format)))
{
nameOfPluginBeingScanned = format.getNameOfPluginFromIdentifier (file);
OwnedArray <PluginDescription> typesFound;
OwnedArray<PluginDescription> typesFound;
// Add this plugin to the end of the dead-man's pedal list in case it crashes...
StringArray crashedPlugins (readDeadMansPedalFile (deadMansPedalFile));
auto crashedPlugins = readDeadMansPedalFile (deadMansPedalFile);
crashedPlugins.removeString (file);
crashedPlugins.add (file);
setDeadMansPedalFile (crashedPlugins);
@ -131,8 +124,6 @@ void PluginDirectoryScanner::applyBlacklistingsFromDeadMansPedal (KnownPluginLis
{
// If any plugins have crashed recently when being loaded, move them to the
// end of the list to give the others a chance to load correctly..
const StringArray crashedPlugins (readDeadMansPedalFile (file));
for (int i = 0; i < crashedPlugins.size(); ++i)
list.addToBlacklist (crashedPlugins[i]);
for (auto& crashedPlugin : readDeadMansPedalFile (file))
list.addToBlacklist (crashedPlugin);
}

View file

@ -117,8 +117,8 @@ private:
File deadMansPedalFile;
StringArray failedFiles;
Atomic<int> nextIndex;
float progress;
bool allowAsync;
float progress = 0;
const bool allowAsync;
void updateProgress();
void setDeadMansPedalFile (const StringArray& newContents);