From fb57b879aa5158ea5890fb93aa69220aa7eebccd Mon Sep 17 00:00:00 2001 From: jules Date: Sat, 8 Jun 2013 13:57:25 +0100 Subject: [PATCH] Exposing some plugin scan path property values. --- .../scanning/juce_PluginListComponent.cpp | 16 ++++++++++++++-- .../scanning/juce_PluginListComponent.h | 7 +++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/modules/juce_audio_processors/scanning/juce_PluginListComponent.cpp b/modules/juce_audio_processors/scanning/juce_PluginListComponent.cpp index 72a7f2e91f..b92e850cb4 100644 --- a/modules/juce_audio_processors/scanning/juce_PluginListComponent.cpp +++ b/modules/juce_audio_processors/scanning/juce_PluginListComponent.cpp @@ -243,6 +243,18 @@ void PluginListComponent::filesDropped (const StringArray& files, int, int) list.scanAndAddDragAndDroppedFiles (formatManager, files, typesFound); } +FileSearchPath PluginListComponent::getLastSearchPath (PropertiesFile& properties, AudioPluginFormat& format) +{ + return properties.getValue ("lastPluginScanPath_" + format.getName(), + format.getDefaultLocationsToSearch().toString()); +} + +void PluginListComponent::setLastSearchPath (PropertiesFile& properties, AudioPluginFormat& format, + const FileSearchPath& newPath) +{ + properties.setValue ("lastPluginScanPath_" + format.getName(), newPath.toString()); +} + //============================================================================== class PluginListComponent::Scanner : private Timer { @@ -262,7 +274,7 @@ public: if (path.getNumPaths() > 0) // if the path is empty, then paths aren't used for this format. { if (propertiesToUse != nullptr) - path = propertiesToUse->getValue ("lastPluginScanPath_" + formatToScan.getName(), path.toString()); + path = getLastSearchPath (*propertiesToUse, formatToScan); pathList.setSize (500, 300); pathList.setPath (path); @@ -311,7 +323,7 @@ private: if (propertiesToUse != nullptr) { - propertiesToUse->setValue ("lastPluginScanPath_" + formatToScan.getName(), pathList.getPath().toString()); + setLastSearchPath (*propertiesToUse, formatToScan, pathList.getPath()); propertiesToUse->saveIfNeeded(); } diff --git a/modules/juce_audio_processors/scanning/juce_PluginListComponent.h b/modules/juce_audio_processors/scanning/juce_PluginListComponent.h index 33de5071a0..31b8acad8d 100644 --- a/modules/juce_audio_processors/scanning/juce_PluginListComponent.h +++ b/modules/juce_audio_processors/scanning/juce_PluginListComponent.h @@ -66,6 +66,13 @@ public: */ void setNumberOfThreadsForScanning (int numThreads); + /** Returns the last search path stored in a given properties file for the specified format. */ + static FileSearchPath getLastSearchPath (PropertiesFile& properties, AudioPluginFormat& format); + + /** Stores a search path in a properties file for the given format. */ + static void setLastSearchPath (PropertiesFile& properties, AudioPluginFormat& format, + const FileSearchPath& newPath); + //============================================================================== /** @internal */ void resized();