vst_host: use FindPaths instead find_directory
This commit is contained in:
@@ -7,6 +7,8 @@
|
|||||||
#include <Entry.h>
|
#include <Entry.h>
|
||||||
#include <Directory.h>
|
#include <Directory.h>
|
||||||
#include <FindDirectory.h>
|
#include <FindDirectory.h>
|
||||||
|
#include <PathFinder.h>
|
||||||
|
#include <StringList.h>
|
||||||
|
|
||||||
#include "VSTNode.h"
|
#include "VSTNode.h"
|
||||||
#include "VSTAddOn.h"
|
#include "VSTAddOn.h"
|
||||||
@@ -22,22 +24,13 @@ VSTAddOn::VSTAddOn(image_id image)
|
|||||||
{
|
{
|
||||||
fPluginsList.MakeEmpty();
|
fPluginsList.MakeEmpty();
|
||||||
|
|
||||||
directory_which dataDirectories[] = {
|
BStringList folders;
|
||||||
B_SYSTEM_ADDONS_DIRECTORY,
|
|
||||||
B_SYSTEM_NONPACKAGED_ADDONS_DIRECTORY,
|
|
||||||
B_USER_ADDONS_DIRECTORY,
|
|
||||||
B_USER_NONPACKAGED_ADDONS_DIRECTORY,
|
|
||||||
};
|
|
||||||
|
|
||||||
for (uint i = 0; i < sizeof(dataDirectories)/sizeof(directory_which); i++) {
|
BPathFinder::FindPaths(B_FIND_PATH_ADD_ONS_DIRECTORY,
|
||||||
BPath path;
|
"media/vstplugins/", B_FIND_PATH_EXISTING_ONLY, folders);
|
||||||
if (find_directory(dataDirectories[i], &path) != B_OK)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
path.Append("media/vstplugins");
|
for (int32 i = 0; i < folders.CountStrings(); i++)
|
||||||
|
ScanPluginsFolder(folders.StringAt(i).String());
|
||||||
ScanPluginsFolders(path.Path());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VSTAddOn::~VSTAddOn()
|
VSTAddOn::~VSTAddOn()
|
||||||
@@ -104,7 +97,7 @@ VSTAddOn::InstantiateNodeFor(const flavor_info* info, BMessage* config,
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
VSTAddOn::ScanPluginsFolders(const char* path, bool make_dir)
|
VSTAddOn::ScanPluginsFolder(const char* path, bool make_dir)
|
||||||
{
|
{
|
||||||
BEntry ent;
|
BEntry ent;
|
||||||
|
|
||||||
@@ -118,7 +111,7 @@ VSTAddOn::ScanPluginsFolders(const char* path, bool make_dir)
|
|||||||
while(dir.GetNextEntry(&ent) == B_OK) {
|
while(dir.GetNextEntry(&ent) == B_OK) {
|
||||||
BPath p(&ent);
|
BPath p(&ent);
|
||||||
if (ent.IsDirectory()) {
|
if (ent.IsDirectory()) {
|
||||||
ScanPluginsFolders(p.Path());
|
ScanPluginsFolder(p.Path());
|
||||||
} else {
|
} else {
|
||||||
VSTPlugin* plugin = new VSTPlugin();
|
VSTPlugin* plugin = new VSTPlugin();
|
||||||
int ret = plugin->LoadModule(p.Path());
|
int ret = plugin->LoadModule(p.Path());
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ public:
|
|||||||
virtual bool WantsAutoStart();
|
virtual bool WantsAutoStart();
|
||||||
virtual status_t AutoStart(int count, BMediaNode** node, int32* id, bool* more);
|
virtual status_t AutoStart(int count, BMediaNode** node, int32* id, bool* more);
|
||||||
private:
|
private:
|
||||||
int ScanPluginsFolders(const char* path, bool make_dir = false);
|
int ScanPluginsFolder(const char* path, bool make_dir = false);
|
||||||
BList fPluginsList;
|
BList fPluginsList;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user