Use PBD::find_files_matching_pattern instead of other variations
This commit is contained in:
parent
36fd67ab72
commit
8d0cba3384
@ -506,15 +506,15 @@ AudioEngine::discover_backends ()
|
||||
#else
|
||||
Glib::PatternSpec dll_extension_pattern("*backend.dll");
|
||||
#endif
|
||||
|
||||
find_matching_files_in_search_path (backend_search_path (),
|
||||
so_extension_pattern, backend_modules);
|
||||
|
||||
find_matching_files_in_search_path (backend_search_path (),
|
||||
dylib_extension_pattern, backend_modules);
|
||||
find_files_matching_pattern (backend_modules, backend_search_path (),
|
||||
so_extension_pattern);
|
||||
|
||||
find_matching_files_in_search_path (backend_search_path (),
|
||||
dll_extension_pattern, backend_modules);
|
||||
find_files_matching_pattern (backend_modules, backend_search_path (),
|
||||
dylib_extension_pattern);
|
||||
|
||||
find_files_matching_pattern (backend_modules, backend_search_path (),
|
||||
dll_extension_pattern);
|
||||
|
||||
DEBUG_TRACE (DEBUG::AudioEngine, string_compose ("looking for backends in %1\n", backend_search_path().to_string()));
|
||||
|
||||
|
@ -268,14 +268,14 @@ ControlProtocolManager::discover_control_protocols ()
|
||||
Glib::PatternSpec so_extension_pattern("*.so");
|
||||
Glib::PatternSpec dylib_extension_pattern("*.dylib");
|
||||
|
||||
find_matching_files_in_search_path (control_protocol_search_path (),
|
||||
dll_extension_pattern, cp_modules);
|
||||
find_files_matching_pattern (cp_modules, control_protocol_search_path (),
|
||||
dll_extension_pattern);
|
||||
|
||||
find_matching_files_in_search_path (control_protocol_search_path (),
|
||||
so_extension_pattern, cp_modules);
|
||||
find_files_matching_pattern (cp_modules, control_protocol_search_path (),
|
||||
so_extension_pattern);
|
||||
|
||||
find_matching_files_in_search_path (control_protocol_search_path (),
|
||||
dylib_extension_pattern, cp_modules);
|
||||
find_files_matching_pattern (cp_modules, control_protocol_search_path (),
|
||||
dylib_extension_pattern);
|
||||
|
||||
DEBUG_TRACE (DEBUG::ControlProtocols,
|
||||
string_compose (_("looking for control protocols in %1\n"), control_protocol_search_path().to_string()));
|
||||
|
@ -332,8 +332,7 @@ ExportProfileManager::find_file (std::string const & pattern)
|
||||
{
|
||||
vector<std::string> found;
|
||||
|
||||
Glib::PatternSpec pattern_spec (pattern);
|
||||
find_matching_files_in_search_path (search_path, pattern_spec, found);
|
||||
find_files_matching_pattern (found, search_path, pattern);
|
||||
|
||||
return found;
|
||||
}
|
||||
|
@ -404,11 +404,9 @@ ARDOUR::find_bindings_files (map<string,string>& files)
|
||||
Searchpath spath = ardour_config_search_path();
|
||||
|
||||
if (getenv ("ARDOUR_SAE")) {
|
||||
Glib::PatternSpec pattern("*SAE-*.bindings");
|
||||
find_matching_files_in_search_path (spath, pattern, found);
|
||||
find_files_matching_pattern (found, spath, "*SAE-*.bindings");
|
||||
} else {
|
||||
Glib::PatternSpec pattern("*.bindings");
|
||||
find_matching_files_in_search_path (spath, pattern, found);
|
||||
find_files_matching_pattern (found, spath, "*.bindings");
|
||||
}
|
||||
|
||||
if (found.empty()) {
|
||||
|
@ -68,10 +68,9 @@ MidiPatchManager::add_session_patches ()
|
||||
|
||||
assert (Glib::file_test (path_to_patches, Glib::FILE_TEST_IS_DIR));
|
||||
|
||||
Glib::PatternSpec pattern(string("*.midnam"));
|
||||
vector<std::string> result;
|
||||
|
||||
find_matching_files_in_directory (path_to_patches, pattern, result);
|
||||
find_files_matching_pattern (result, path_to_patches, "*.midnam");
|
||||
|
||||
info << "Loading " << result.size() << " MIDI patches from " << path_to_patches << endmsg;
|
||||
|
||||
@ -104,10 +103,9 @@ MidiPatchManager::refresh()
|
||||
_all_models.clear();
|
||||
|
||||
Searchpath search_path = midi_patch_search_path ();
|
||||
Glib::PatternSpec pattern (string("*.midnam"));
|
||||
vector<std::string> result;
|
||||
|
||||
find_matching_files_in_search_path (search_path, pattern, result);
|
||||
find_files_matching_pattern (result, search_path, "*.midnam");
|
||||
|
||||
info << "Loading " << result.size() << " MIDI patches from " << search_path.to_string() << endmsg;
|
||||
|
||||
|
@ -326,18 +326,9 @@ PluginManager::ladspa_refresh ()
|
||||
|
||||
DEBUG_TRACE (DEBUG::PluginManager, string_compose ("LADSPA: search along: [%1]\n", ladspa_search_path().to_string()));
|
||||
|
||||
Glib::PatternSpec so_extension_pattern("*.so");
|
||||
Glib::PatternSpec dylib_extension_pattern("*.dylib");
|
||||
Glib::PatternSpec dll_extension_pattern("*.dll");
|
||||
|
||||
find_matching_files_in_search_path (ladspa_search_path (),
|
||||
so_extension_pattern, ladspa_modules);
|
||||
|
||||
find_matching_files_in_search_path (ladspa_search_path (),
|
||||
dylib_extension_pattern, ladspa_modules);
|
||||
|
||||
find_matching_files_in_search_path (ladspa_search_path (),
|
||||
dll_extension_pattern, ladspa_modules);
|
||||
find_files_matching_pattern (ladspa_modules, ladspa_search_path (), "*.so");
|
||||
find_files_matching_pattern (ladspa_modules, ladspa_search_path (), "*.dylib");
|
||||
find_files_matching_pattern (ladspa_modules, ladspa_search_path (), "*.dll");
|
||||
|
||||
for (vector<std::string>::iterator i = ladspa_modules.begin(); i != ladspa_modules.end(); ++i) {
|
||||
ARDOUR::PluginScanMessage(_("LADSPA"), *i, false);
|
||||
|
@ -47,10 +47,8 @@ void
|
||||
get_state_files_in_directory (const std::string & directory_path,
|
||||
vector<std::string> & result)
|
||||
{
|
||||
Glib::PatternSpec state_file_pattern('*' + string(statefile_suffix));
|
||||
|
||||
find_matching_files_in_directory (directory_path, state_file_pattern,
|
||||
result);
|
||||
find_files_matching_pattern (result, directory_path,
|
||||
'*' + string(statefile_suffix));
|
||||
}
|
||||
|
||||
vector<string>
|
||||
|
@ -616,8 +616,7 @@ ARDOUR::get_jack_server_paths (const vector<std::string>& server_dir_paths,
|
||||
vector<std::string>& server_paths)
|
||||
{
|
||||
for (vector<string>::const_iterator i = server_names.begin(); i != server_names.end(); ++i) {
|
||||
Glib::PatternSpec ps (*i);
|
||||
find_matching_files_in_directories (server_dir_paths, ps, server_paths);
|
||||
find_files_matching_pattern (server_paths, server_dir_paths, *i);
|
||||
}
|
||||
return !server_paths.empty();
|
||||
}
|
||||
|
@ -160,7 +160,7 @@ MidnamTest::load_all_midnams_test ()
|
||||
Glib::PatternSpec pattern(string("*.midnam"));
|
||||
vector<std::string> result;
|
||||
|
||||
PBD::find_matching_files_in_directory (prefix, pattern, result);
|
||||
PBD::find_files_matching_pattern (result, prefix, pattern);
|
||||
|
||||
cout << "Loading " << result.size() << " MIDI patches from " << prefix << endl;
|
||||
|
||||
|
@ -146,39 +146,14 @@ find_files_matching_pattern (vector<string>& result,
|
||||
find_files_matching_pattern (result, paths, tmp);
|
||||
}
|
||||
|
||||
void
|
||||
find_matching_files_in_directory (const std::string& directory,
|
||||
const Glib::PatternSpec& pattern,
|
||||
vector<std::string>& result)
|
||||
{
|
||||
find_files_matching_pattern (result, directory, pattern);
|
||||
}
|
||||
|
||||
void
|
||||
find_matching_files_in_directories (const vector<std::string>& paths,
|
||||
const Glib::PatternSpec& pattern,
|
||||
vector<std::string>& result)
|
||||
{
|
||||
find_files_matching_pattern (result, paths, pattern);
|
||||
}
|
||||
|
||||
void
|
||||
find_matching_files_in_search_path (const Searchpath& search_path,
|
||||
const Glib::PatternSpec& pattern,
|
||||
vector<std::string>& result)
|
||||
{
|
||||
find_files_matching_pattern (result, search_path, pattern);
|
||||
}
|
||||
|
||||
bool
|
||||
find_file_in_search_path(const Searchpath& search_path,
|
||||
const string& filename,
|
||||
std::string& result)
|
||||
{
|
||||
vector<std::string> tmp;
|
||||
Glib::PatternSpec tmp_pattern(filename);
|
||||
|
||||
find_matching_files_in_search_path (search_path, tmp_pattern, tmp);
|
||||
find_files_matching_pattern (tmp, search_path, filename);
|
||||
|
||||
if (tmp.size() == 0)
|
||||
{
|
||||
|
@ -89,45 +89,6 @@ find_files_matching_pattern (std::vector<std::string>& result,
|
||||
const Searchpath& paths,
|
||||
const std::string& pattern);
|
||||
|
||||
/**
|
||||
* Takes a directory path and returns all the files in the directory
|
||||
* matching a particular pattern.
|
||||
*
|
||||
* @param directory A directory path
|
||||
* @param pattern A Glib::PatternSpec used to match the files.
|
||||
* @param result A vector in which to place the resulting matches.
|
||||
*/
|
||||
LIBPBD_API void
|
||||
find_matching_files_in_directory (const std::string& directory,
|
||||
const Glib::PatternSpec& pattern,
|
||||
std::vector<std::string>& result);
|
||||
|
||||
/**
|
||||
* Takes a number of directory paths and returns all the files matching
|
||||
* a particular pattern.
|
||||
*
|
||||
* @param paths A vector containing the Absolute paths
|
||||
* @param pattern A Glib::PatternSpec used to match the files
|
||||
* @param result A vector in which to place the resulting matches.
|
||||
*/
|
||||
LIBPBD_API void
|
||||
find_matching_files_in_directories (const std::vector<std::string>& directory_paths,
|
||||
const Glib::PatternSpec& pattern,
|
||||
std::vector<std::string>& result);
|
||||
|
||||
/**
|
||||
* Takes a Searchpath and puts a list of all the files in the search path
|
||||
* that match pattern into the result vector.
|
||||
*
|
||||
* @param search_path A Searchpath
|
||||
* @param pattern A Glib::PatternSpec used to match the files
|
||||
* @param result A vector in which to place the resulting matches.
|
||||
*/
|
||||
LIBPBD_API void
|
||||
find_matching_files_in_search_path (const Searchpath& search_path,
|
||||
const Glib::PatternSpec& pattern,
|
||||
std::vector<std::string>& result);
|
||||
|
||||
/**
|
||||
* Takes a search path and a file name and place the full path
|
||||
* to that file in result if it is found within the search path.
|
||||
|
Loading…
Reference in New Issue
Block a user