Replace all use of PathScanner with equivalent functions from pbd/file_utils.h
This commit is contained in:
parent
cb6934a189
commit
547689a055
|
@ -28,7 +28,7 @@
|
|||
#include "pbd/xml++.h"
|
||||
#include "pbd/convert.h"
|
||||
#include "pbd/whitespace.h"
|
||||
#include "pbd/pathscanner.h"
|
||||
#include "pbd/file_utils.h"
|
||||
#include "pbd/locale_guard.h"
|
||||
|
||||
#include <glibmm/threads.h>
|
||||
|
@ -2049,20 +2049,19 @@ AUPlugin::current_preset() const
|
|||
void
|
||||
AUPlugin::find_presets ()
|
||||
{
|
||||
vector<string*>* preset_files;
|
||||
PathScanner scanner;
|
||||
vector<string> preset_files;
|
||||
|
||||
user_preset_map.clear ();
|
||||
|
||||
preset_files = scanner (preset_search_path, au_preset_filter, this, true, true, -1, true);
|
||||
find_files_matching_filter (preset_files, preset_search_path, au_preset_filter, this, true, true, -1, true);
|
||||
|
||||
if (!preset_files) {
|
||||
if (preset_files.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (vector<string*>::iterator x = preset_files->begin(); x != preset_files->end(); ++x) {
|
||||
for (vector<string>::iterator x = preset_files.begin(); x != preset_files.end(); ++x) {
|
||||
|
||||
string path = *(*x);
|
||||
string path = *x;
|
||||
string preset_name;
|
||||
|
||||
/* make an initial guess at the preset name using the path */
|
||||
|
@ -2079,12 +2078,8 @@ AUPlugin::find_presets ()
|
|||
user_preset_map[preset_name] = path;
|
||||
}
|
||||
|
||||
delete *x;
|
||||
}
|
||||
|
||||
vector_delete (preset_files);
|
||||
delete preset_files;
|
||||
|
||||
/* now fill the vector<string> with the names we have */
|
||||
|
||||
for (UserPresetMap::iterator i = user_preset_map.begin(); i != user_preset_map.end(); ++i) {
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#include <boost/utility.hpp>
|
||||
|
||||
#include "pbd/clear_dir.h"
|
||||
#include "pbd/pathscanner.h"
|
||||
#include "pbd/file_utils.h"
|
||||
#include "pbd/stl_delete.h"
|
||||
#include "pbd/compose.h"
|
||||
#include "pbd/error.h"
|
||||
|
@ -2013,10 +2013,10 @@ void
|
|||
LV2World::load_bundled_plugins()
|
||||
{
|
||||
if (!_bundle_checked) {
|
||||
PathScanner scanner;
|
||||
cout << "Scanning folders for bundled LV2s: " << ARDOUR::lv2_bundled_search_path().to_string() << endl;
|
||||
|
||||
vector<string> plugin_objects = scanner (ARDOUR::lv2_bundled_search_path().to_string(), lv2_filter, 0, true, true);
|
||||
vector<string> plugin_objects;
|
||||
find_files_matching_filter (plugin_objects, ARDOUR::lv2_bundled_search_path().to_string(), lv2_filter, 0, true, true);
|
||||
for ( vector<string>::iterator x = plugin_objects.begin(); x != plugin_objects.end (); ++x) {
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
string uri = "file:///" + *x + "/";
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
#include "pbd/error.h"
|
||||
#include "pbd/compose.h"
|
||||
#include "pbd/pathscanner.h"
|
||||
#include "pbd/file_utils.h"
|
||||
#include "pbd/stl_delete.h"
|
||||
|
||||
#include "ardour/debug.h"
|
||||
|
@ -90,13 +90,12 @@ static bool panner_filter (const string& str, void */*arg*/)
|
|||
void
|
||||
PannerManager::discover_panners ()
|
||||
{
|
||||
PathScanner scanner;
|
||||
std::vector<std::string> panner_modules;
|
||||
std::string search_path = panner_search_path().to_string();
|
||||
|
||||
DEBUG_TRACE (DEBUG::Panning, string_compose (_("looking for panners in %1\n"), search_path));
|
||||
|
||||
panner_modules = scanner (search_path, panner_filter, 0, false, true, 1, true);
|
||||
find_files_matching_filter (panner_modules, search_path, panner_filter, 0, false, true, 1, true);
|
||||
|
||||
for (vector<std::string>::iterator i = panner_modules.begin(); i != panner_modules.end(); ++i) {
|
||||
panner_discover (*i);
|
||||
|
|
|
@ -50,7 +50,6 @@
|
|||
#include <glibmm/miscutils.h>
|
||||
#include <glibmm/pattern.h>
|
||||
|
||||
#include "pbd/pathscanner.h"
|
||||
#include "pbd/whitespace.h"
|
||||
#include "pbd/file_utils.h"
|
||||
|
||||
|
@ -242,10 +241,8 @@ PluginManager::clear_vst_cache ()
|
|||
// see also libs/ardour/vst_info_file.cc - vstfx_infofile_path()
|
||||
#ifdef WINDOWS_VST_SUPPORT
|
||||
{
|
||||
PathScanner scanner;
|
||||
vector<string> fsi_files;
|
||||
|
||||
fsi_files = scanner (Config->get_plugin_path_vst(), "\\.fsi$", true, true, -1, false);
|
||||
find_files_matching_regex (fsi_files, Config->get_plugin_path_vst(), "\\.fsi$", true, true, -1, false);
|
||||
for (vector<string>::iterator i = fsi_files.begin(); i != fsi_files.end (); ++i) {
|
||||
::g_unlink(i->c_str());
|
||||
}
|
||||
|
@ -254,9 +251,8 @@ PluginManager::clear_vst_cache ()
|
|||
|
||||
#ifdef LXVST_SUPPORT
|
||||
{
|
||||
PathScanner scanner;
|
||||
vector<string> fsi_files;
|
||||
fsi_files = scanner (Config->get_plugin_path_lxvst(), "\\.fsi$", true, true, -1, false);
|
||||
find_files_matching_regex (fsi_files, Config->get_plugin_path_lxvst(), "\\.fsi$", true, true, -1, false);
|
||||
for (vector<string>::iterator i = fsi_files.begin(); i != fsi_files.end (); ++i) {
|
||||
::g_unlink(i->c_str());
|
||||
}
|
||||
|
@ -266,9 +262,8 @@ PluginManager::clear_vst_cache ()
|
|||
#if (defined WINDOWS_VST_SUPPORT || defined LXVST_SUPPORT)
|
||||
{
|
||||
string personal = get_personal_vst_info_cache_dir();
|
||||
PathScanner scanner;
|
||||
vector<string> fsi_files;
|
||||
fsi_files = scanner (personal, "\\.fsi$", true, true, -1, false);
|
||||
find_files_matching_regex (fsi_files, personal, "\\.fsi$", true, true, -1, false);
|
||||
for (vector<string>::iterator i = fsi_files.begin(); i != fsi_files.end (); ++i) {
|
||||
::g_unlink(i->c_str());
|
||||
}
|
||||
|
@ -281,10 +276,8 @@ PluginManager::clear_vst_blacklist ()
|
|||
{
|
||||
#ifdef WINDOWS_VST_SUPPORT
|
||||
{
|
||||
PathScanner scanner;
|
||||
vector<string> fsi_files;
|
||||
|
||||
fsi_files = scanner (Config->get_plugin_path_vst(), "\\.fsb$", true, true, -1, false);
|
||||
find_files_matching_regex (fsi_files, Config->get_plugin_path_vst(), "\\.fsb$", true, true, -1, false);
|
||||
for (vector<string>::iterator i = fsi_files.begin(); i != fsi_files.end (); ++i) {
|
||||
::g_unlink(i->c_str());
|
||||
}
|
||||
|
@ -293,9 +286,8 @@ PluginManager::clear_vst_blacklist ()
|
|||
|
||||
#ifdef LXVST_SUPPORT
|
||||
{
|
||||
PathScanner scanner;
|
||||
vector<string> fsi_files;
|
||||
fsi_files = scanner (Config->get_plugin_path_lxvst(), "\\.fsb$", true, true, -1, false);
|
||||
find_files_matching_regex (fsi_files, Config->get_plugin_path_lxvst(), "\\.fsb$", true, true, -1, false);
|
||||
for (vector<string>::iterator i = fsi_files.begin(); i != fsi_files.end (); ++i) {
|
||||
::g_unlink(i->c_str());
|
||||
}
|
||||
|
@ -306,9 +298,8 @@ PluginManager::clear_vst_blacklist ()
|
|||
{
|
||||
string personal = get_personal_vst_blacklist_dir();
|
||||
|
||||
PathScanner scanner;
|
||||
vector<string> fsi_files;
|
||||
fsi_files = scanner (personal, "\\.fsb$", true, true, -1, false);
|
||||
find_files_matching_regex (fsi_files, personal, "\\.fsb$", true, true, -1, false);
|
||||
for (vector<string>::iterator i = fsi_files.begin(); i != fsi_files.end (); ++i) {
|
||||
::g_unlink(i->c_str());
|
||||
}
|
||||
|
@ -385,7 +376,6 @@ void
|
|||
PluginManager::add_presets(string domain)
|
||||
{
|
||||
#ifdef HAVE_LRDF
|
||||
PathScanner scanner;
|
||||
vector<string> presets;
|
||||
vector<string>::iterator x;
|
||||
|
||||
|
@ -395,7 +385,7 @@ PluginManager::add_presets(string domain)
|
|||
}
|
||||
|
||||
string path = string_compose("%1/.%2/rdf", envvar, domain);
|
||||
presets = scanner (path, rdf_filter, 0, false, true);
|
||||
find_files_matching_filter (presets, path, rdf_filter, 0, false, true);
|
||||
|
||||
for (x = presets.begin(); x != presets.end (); ++x) {
|
||||
string file = "file:" + *x;
|
||||
|
@ -411,11 +401,10 @@ void
|
|||
PluginManager::add_lrdf_data (const string &path)
|
||||
{
|
||||
#ifdef HAVE_LRDF
|
||||
PathScanner scanner;
|
||||
vector<string> rdf_files;
|
||||
vector<string>::iterator x;
|
||||
|
||||
rdf_files = scanner (path, rdf_filter, 0, false, true);
|
||||
find_files_matching_filter (rdf_files, path, rdf_filter, 0, false, true);
|
||||
|
||||
for (x = rdf_files.begin(); x != rdf_files.end (); ++x) {
|
||||
const string uri(string("file://") + *x);
|
||||
|
@ -628,14 +617,13 @@ static bool windows_vst_filter (const string& str, void * /*arg*/)
|
|||
int
|
||||
PluginManager::windows_vst_discover_from_path (string path, bool cache_only)
|
||||
{
|
||||
PathScanner scanner;
|
||||
vector<string> plugin_objects;
|
||||
vector<string>::iterator x;
|
||||
int ret = 0;
|
||||
|
||||
DEBUG_TRACE (DEBUG::PluginManager, string_compose ("detecting Windows VST plugins along %1\n", path));
|
||||
|
||||
plugin_objects = scanner (Config->get_plugin_path_vst(), windows_vst_filter, 0, false, true);
|
||||
find_files_matching_filter (plugin_objects, Config->get_plugin_path_vst(), windows_vst_filter, 0, false, true);
|
||||
|
||||
for (x = plugin_objects.begin(); x != plugin_objects.end (); ++x) {
|
||||
ARDOUR::PluginScanMessage(_("VST"), *x, !cache_only && !cancelled());
|
||||
|
@ -744,7 +732,6 @@ static bool lxvst_filter (const string& str, void *)
|
|||
int
|
||||
PluginManager::lxvst_discover_from_path (string path, bool cache_only)
|
||||
{
|
||||
PathScanner scanner;
|
||||
vector<string> plugin_objects;
|
||||
vector<string>::iterator x;
|
||||
int ret = 0;
|
||||
|
@ -755,7 +742,7 @@ PluginManager::lxvst_discover_from_path (string path, bool cache_only)
|
|||
|
||||
DEBUG_TRACE (DEBUG::PluginManager, string_compose ("Discovering linuxVST plugins along %1\n", path));
|
||||
|
||||
plugin_objects = scanner (Config->get_plugin_path_lxvst(), lxvst_filter, 0, false, true);
|
||||
find_files_matching_filter (plugin_objects, Config->get_plugin_path_lxvst(), lxvst_filter, 0, false, true);
|
||||
|
||||
for (x = plugin_objects.begin(); x != plugin_objects.end (); ++x) {
|
||||
ARDOUR::PluginScanMessage(_("LXVST"), *x, !cache_only && !cancelled());
|
||||
|
|
|
@ -69,7 +69,6 @@
|
|||
#include "pbd/error.h"
|
||||
#include "pbd/file_utils.h"
|
||||
#include "pbd/pathexpand.h"
|
||||
#include "pbd/pathscanner.h"
|
||||
#include "pbd/pthread_utils.h"
|
||||
#include "pbd/stacktrace.h"
|
||||
#include "pbd/convert.h"
|
||||
|
@ -2319,8 +2318,8 @@ remove_end(string state)
|
|||
vector<string>
|
||||
Session::possible_states (string path)
|
||||
{
|
||||
PathScanner scanner;
|
||||
vector<string> states = scanner (path, state_file_filter, 0, false, false);
|
||||
vector<string> states;
|
||||
find_files_matching_filter (states, path, state_file_filter, 0, false, false);
|
||||
|
||||
transform(states.begin(), states.end(), states.begin(), remove_end);
|
||||
|
||||
|
@ -2553,7 +2552,6 @@ Session::find_all_sources (string path, set<string>& result)
|
|||
int
|
||||
Session::find_all_sources_across_snapshots (set<string>& result, bool exclude_this_snapshot)
|
||||
{
|
||||
PathScanner scanner;
|
||||
vector<string> state_files;
|
||||
string ripped;
|
||||
string this_snapshot_path;
|
||||
|
@ -2566,7 +2564,7 @@ Session::find_all_sources_across_snapshots (set<string>& result, bool exclude_th
|
|||
ripped = ripped.substr (0, ripped.length() - 1);
|
||||
}
|
||||
|
||||
state_files = scanner (ripped, accept_all_state_files, (void *) 0, true, true);
|
||||
find_files_matching_filter (state_files, ripped, accept_all_state_files, (void *) 0, true, true);
|
||||
|
||||
if (state_files.empty()) {
|
||||
/* impossible! */
|
||||
|
@ -2633,13 +2631,11 @@ Session::cleanup_sources (CleanupReport& rep)
|
|||
// FIXME: needs adaptation to midi
|
||||
|
||||
vector<boost::shared_ptr<Source> > dead_sources;
|
||||
PathScanner scanner;
|
||||
string audio_path;
|
||||
string midi_path;
|
||||
vector<space_and_path>::iterator i;
|
||||
vector<space_and_path>::iterator nexti;
|
||||
vector<string> candidates;
|
||||
vector<string> candidates2;
|
||||
vector<string> unused;
|
||||
set<string> all_sources;
|
||||
bool used;
|
||||
|
@ -2721,14 +2717,8 @@ Session::cleanup_sources (CleanupReport& rep)
|
|||
i = nexti;
|
||||
}
|
||||
|
||||
candidates = scanner (audio_path, accept_all_audio_files, (void *) 0, true, true);
|
||||
candidates2 = scanner (midi_path, accept_all_midi_files, (void *) 0, true, true);
|
||||
|
||||
/* merge them */
|
||||
|
||||
for (vector<string>::iterator i = candidates2.begin(); i != candidates2.end(); ++i) {
|
||||
candidates.push_back (*i);
|
||||
}
|
||||
find_files_matching_filter (candidates, audio_path, accept_all_audio_files, (void *) 0, true, true);
|
||||
find_files_matching_filter (candidates, midi_path, accept_all_midi_files, (void *) 0, true, true);
|
||||
|
||||
/* find all sources, but don't use this snapshot because the
|
||||
state file on disk still references sources we may have already
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include <glibmm.h>
|
||||
|
||||
#include "pbd/basename.h"
|
||||
#include "pbd/pathscanner.h"
|
||||
#include "pbd/file_utils.h"
|
||||
#include "pbd/stl_delete.h"
|
||||
#include "pbd/xml++.h"
|
||||
|
||||
|
@ -82,10 +82,9 @@ void
|
|||
find_session_templates (vector<TemplateInfo>& template_names)
|
||||
{
|
||||
vector<string> templates;
|
||||
PathScanner scanner;
|
||||
Searchpath spath (template_search_path());
|
||||
|
||||
templates = scanner (spath.to_string(), template_filter, 0, true, true);
|
||||
find_files_matching_filter (templates, spath.to_string(), template_filter, 0, true, true);
|
||||
|
||||
if (templates.empty()) {
|
||||
cerr << "Found nothing along " << spath.to_string() << endl;
|
||||
|
@ -116,10 +115,9 @@ void
|
|||
find_route_templates (vector<TemplateInfo>& template_names)
|
||||
{
|
||||
vector<string> templates;
|
||||
PathScanner scanner;
|
||||
Searchpath spath (route_template_search_path());
|
||||
|
||||
templates = scanner (spath.to_string(), route_template_filter, 0, false, true);
|
||||
find_files_matching_filter (templates, spath.to_string(), route_template_filter, 0, false, true);
|
||||
|
||||
if (templates.empty()) {
|
||||
return;
|
||||
|
|
|
@ -58,7 +58,6 @@
|
|||
#include "pbd/file_utils.h"
|
||||
#include "pbd/debug.h"
|
||||
#include "pbd/error.h"
|
||||
#include "pbd/pathscanner.h"
|
||||
#include "pbd/pathexpand.h"
|
||||
#include "pbd/stl_delete.h"
|
||||
|
||||
|
@ -354,8 +353,8 @@ bool accept_all_files (string const &, void *)
|
|||
void
|
||||
copy_files(const std::string & from_path, const std::string & to_dir)
|
||||
{
|
||||
PathScanner scanner;
|
||||
vector<string> files = scanner (from_path, accept_all_files, 0, true, false);
|
||||
vector<string> files;
|
||||
find_files_matching_filter (files, from_path, accept_all_files, 0, true, false);
|
||||
|
||||
for (vector<string>::iterator i = files.begin(); i != files.end(); ++i) {
|
||||
std::string from = Glib::build_filename (from_path, *i);
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include "pbd/controllable_descriptor.h"
|
||||
#include "pbd/error.h"
|
||||
#include "pbd/failed_constructor.h"
|
||||
#include "pbd/pathscanner.h"
|
||||
#include "pbd/file_utils.h"
|
||||
#include "pbd/xml++.h"
|
||||
|
||||
#include "midi++/port.h"
|
||||
|
@ -137,11 +137,10 @@ void
|
|||
GenericMidiControlProtocol::reload_maps ()
|
||||
{
|
||||
vector<string> midi_maps;
|
||||
PathScanner scanner;
|
||||
Searchpath spath (system_midi_map_search_path());
|
||||
spath += user_midi_map_directory ();
|
||||
|
||||
midi_maps = scanner (spath.to_string(), midi_map_filter, 0, false, true);
|
||||
find_files_matching_filter (midi_maps, spath.to_string(), midi_map_filter, 0, false, true);
|
||||
|
||||
if (midi_maps.empty()) {
|
||||
cerr << "No MIDI maps found using " << spath.to_string() << endl;
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
#include "pbd/xml++.h"
|
||||
#include "pbd/error.h"
|
||||
#include "pbd/pathscanner.h"
|
||||
#include "pbd/file_utils.h"
|
||||
#include "pbd/convert.h"
|
||||
#include "pbd/stl_delete.h"
|
||||
|
||||
|
@ -472,10 +472,9 @@ DeviceInfo::reload_device_info ()
|
|||
DeviceInfo di;
|
||||
vector<string> s;
|
||||
vector<string> devinfos;
|
||||
PathScanner scanner;
|
||||
Searchpath spath (devinfo_search_path());
|
||||
|
||||
devinfos = scanner (spath.to_string(), devinfo_filter, 0, false, true);
|
||||
find_files_matching_filter (devinfos, spath.to_string(), devinfo_filter, 0, false, true);
|
||||
device_info.clear ();
|
||||
|
||||
if (devinfos.empty()) {
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
#include "pbd/xml++.h"
|
||||
#include "pbd/error.h"
|
||||
#include "pbd/pathscanner.h"
|
||||
#include "pbd/file_utils.h"
|
||||
#include "pbd/stl_delete.h"
|
||||
#include "pbd/replace_all.h"
|
||||
|
||||
|
@ -91,10 +91,9 @@ DeviceProfile::reload_device_profiles ()
|
|||
DeviceProfile dp;
|
||||
vector<string> s;
|
||||
vector<string> devprofiles;
|
||||
PathScanner scanner;
|
||||
Searchpath spath (devprofile_search_path());
|
||||
|
||||
devprofiles = scanner (spath.to_string(), devprofile_filter, 0, false, true);
|
||||
find_files_matching_filter (devprofiles, spath.to_string(), devprofile_filter, 0, false, true);
|
||||
device_profiles.clear ();
|
||||
|
||||
if (devprofiles.empty()) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user