29static StringArray readDeadMansPedalFile (
const File& file)
32 file.readLines (lines);
41 const File& deadMansPedal,
42 bool allowPluginsWhichRequireAsynchronousInstantiation)
44 format (formatToLookFor),
45 deadMansPedalFile (deadMansPedal),
46 allowAsync (allowPluginsWhichRequireAsynchronousInstantiation)
60 filesOrIdentifiersToScan = filesOrIdentifiers;
64 for (
auto& crashed : readDeadMansPedalFile (deadMansPedalFile))
65 for (
int j = filesOrIdentifiersToScan.
size(); --j >= 0;)
66 if (crashed == filesOrIdentifiersToScan[j])
67 filesOrIdentifiersToScan.
move (j, -1);
70 nextIndex.
set (filesOrIdentifiersToScan.
size());
78void PluginDirectoryScanner::updateProgress()
80 progress = (1.0f - (
float) nextIndex.
get() / (
float) filesOrIdentifiersToScan.
size());
84 String& nameOfPluginBeingScanned)
86 const int index = --nextIndex;
90 auto file = filesOrIdentifiersToScan [index];
92 if (file.isNotEmpty() && ! (dontRescanIfAlreadyInList && list.
isListingUpToDate (file, format)))
99 auto crashedPlugins = readDeadMansPedalFile (deadMansPedalFile);
100 crashedPlugins.removeString (file);
101 crashedPlugins.add (file);
102 setDeadMansPedalFile (crashedPlugins);
104 list.
scanAndAddFile (file, dontRescanIfAlreadyInList, typesFound, format);
107 crashedPlugins.removeString (file);
108 setDeadMansPedalFile (crashedPlugins);
111 failedFiles.
add (file);
122 return --nextIndex > 0;
125void PluginDirectoryScanner::setDeadMansPedalFile (
const StringArray& newContents)
135 for (
auto& crashedPlugin : readDeadMansPedalFile (file))
136 list.addToBlacklist (crashedPlugin);
Represents a set of folders that make up a search path.
void removeRedundantPaths()
Removes any directories that are actually subdirectories of one of the other directories in the searc...
Represents a local file or directory.
bool replaceWithText(const String &textToWrite, bool asUnicode=false, bool writeUnicodeHeaderBytes=false, const char *lineEndings="\r\n") const
Replaces this file's contents with a given text string.
const String & getFullPathName() const noexcept
Returns the complete, absolute path of this file.
Manages a list of plugin types.
bool isListingUpToDate(const String &possiblePluginFileOrIdentifier, AudioPluginFormat &formatToUse) const
Returns true if the specified file is already known about and if it hasn't been modified since our en...
bool scanAndAddFile(const String &possiblePluginFileOrIdentifier, bool dontRescanIfAlreadyInList, OwnedArray< PluginDescription > &typesFound, AudioPluginFormat &formatToUse)
Looks for all types that can be loaded from a given file, and adds them to the list.
const StringArray & getBlacklistedFiles() const
Returns the list of blacklisted files.
void scanFinished()
Tells a custom scanner that a scan has finished, and it can release any resources.
An array designed for holding objects.
int size() const noexcept
Returns the number of items currently in the array.
static void applyBlacklistingsFromDeadMansPedal(KnownPluginList &listToApplyTo, const File &deadMansPedalFile)
Reads the given dead-mans-pedal file and applies its contents to the list.
PluginDirectoryScanner(KnownPluginList &listToAddResultsTo, AudioPluginFormat &formatToLookFor, FileSearchPath directoriesToSearch, bool searchRecursively, const File &deadMansPedalFile, bool allowPluginsWhichRequireAsynchronousInstantiation=false)
Creates a scanner.
bool skipNextFile()
Skips over the next file without scanning it.
~PluginDirectoryScanner()
Destructor.
String getNextPluginFileThatWillBeScanned() const
Returns the description of the plugin that will be scanned during the next call to scanNextFile().
bool scanNextFile(bool dontRescanIfAlreadyInList, String &nameOfPluginBeingScanned)
Tries the next likely-looking file.
void setFilesOrIdentifiersToScan(const StringArray &filesOrIdentifiersToScan)
Sets a specific list of filesOrIdentifiersToScan to scan.
A special array for holding a list of strings.
String joinIntoString(StringRef separatorString, int startIndex=0, int numberOfElements=-1) const
Joins the strings in the array together into one string.
void removeEmptyStrings(bool removeWhitespaceStrings=true)
Removes empty strings from the array.
bool contains(StringRef stringToLookFor, bool ignoreCase=false) const
Searches for a string in the array.
void move(int currentIndex, int newIndex) noexcept
Moves one of the strings to a different position.
int size() const noexcept
Returns the number of strings in the array.
void add(String stringToAdd)
Appends a string at the end of the array.
bool isNotEmpty() const noexcept
Returns true if the string contains at least one character.
Type get() const noexcept
Atomically reads and returns the current value.
void set(Type newValue) noexcept
Atomically sets the current value.