Rename SearchPath class Searchpath

Windows headers define SearchPath which means we have to undefine it
where necessary. This is a pain and can be tricksy, so I feel renaming
the class slightly is the easiest solution.
This commit is contained in:
Tim Mayberry 2013-08-15 20:04:08 +10:00
parent e6c7ecf0e3
commit 8ddd12a60d
46 changed files with 125 additions and 189 deletions

View file

@ -40,10 +40,6 @@
#include "i18n.h" #include "i18n.h"
#ifdef SearchPath
#undef SearchPath
#endif
using namespace Gtk; using namespace Gtk;
using namespace Gdk; using namespace Gdk;
using namespace std; using namespace std;
@ -564,7 +560,7 @@ About::About ()
std::string splash_file; std::string splash_file;
SearchPath spath(ardour_data_search_path()); Searchpath spath(ardour_data_search_path());
if (find_file_in_search_path (spath, "splash.png", splash_file)) { if (find_file_in_search_path (spath, "splash.png", splash_file)) {
set_logo (Gdk::Pixbuf::create_from_file (splash_file)); set_logo (Gdk::Pixbuf::create_from_file (splash_file));

View file

@ -28,10 +28,6 @@
#include "i18n.h" #include "i18n.h"
#ifdef SearchPath
#undef SearchPath
#endif
using namespace std; using namespace std;
using namespace Gtk; using namespace Gtk;
using namespace PBD; using namespace PBD;

View file

@ -26,10 +26,6 @@
#include "missing_file_dialog.h" #include "missing_file_dialog.h"
#include "i18n.h" #include "i18n.h"
#ifdef SearchPath
#undef SearchPath
#endif
using namespace Gtk; using namespace Gtk;
using namespace std; using namespace std;
using namespace ARDOUR; using namespace ARDOUR;

View file

@ -35,10 +35,6 @@
#include "i18n.h" #include "i18n.h"
#ifdef SearchPath
#undef SearchPath
#endif
using namespace ARDOUR; using namespace ARDOUR;
using namespace Gtk; using namespace Gtk;
using namespace PBD; using namespace PBD;

View file

@ -36,10 +36,6 @@
#include "i18n.h" #include "i18n.h"
#ifdef SearchPath
#undef SearchPath
#endif
using namespace std; using namespace std;
using namespace Gtk; using namespace Gtk;
using namespace Glib; using namespace Glib;

View file

@ -32,10 +32,6 @@
#include "i18n.h" #include "i18n.h"
#ifdef SearchPath
#undef SearchPath
#endif
using namespace PBD; using namespace PBD;
using namespace VideoUtils; using namespace VideoUtils;
@ -55,7 +51,7 @@ TranscodeFfmpeg::TranscodeFfmpeg (std::string f)
#endif #endif
std::string ff_file_path; std::string ff_file_path;
if (find_file_in_search_path (SearchPath(Glib::getenv("PATH")), X_("ffmpeg_harvid"), ff_file_path)) { ffmpeg_exe = ff_file_path; } if (find_file_in_search_path (Searchpath(Glib::getenv("PATH")), X_("ffmpeg_harvid"), ff_file_path)) { ffmpeg_exe = ff_file_path; }
else if (Glib::file_test(X_("C:\\Program Files\\harvid\\ffmpeg.exe"), Glib::FILE_TEST_EXISTS)) { else if (Glib::file_test(X_("C:\\Program Files\\harvid\\ffmpeg.exe"), Glib::FILE_TEST_EXISTS)) {
ffmpeg_exe = X_("C:\\Program Files\\ffmpeg\\ffmpeg.exe"); ffmpeg_exe = X_("C:\\Program Files\\ffmpeg\\ffmpeg.exe");
} }
@ -63,7 +59,7 @@ TranscodeFfmpeg::TranscodeFfmpeg (std::string f)
ffmpeg_exe = X_("C:\\Program Files\\ffmpeg\\ffmpeg.exe"); ffmpeg_exe = X_("C:\\Program Files\\ffmpeg\\ffmpeg.exe");
} }
if (find_file_in_search_path (SearchPath(Glib::getenv("PATH")), X_("ffprobe_harvid"), ff_file_path)) { ffprobe_exe = ff_file_path; } if (find_file_in_search_path (Searchpath(Glib::getenv("PATH")), X_("ffprobe_harvid"), ff_file_path)) { ffprobe_exe = ff_file_path; }
else if (Glib::file_test(X_("C:\\Program Files\\harvid\\ffprobe.exe"), Glib::FILE_TEST_EXISTS)) { else if (Glib::file_test(X_("C:\\Program Files\\harvid\\ffprobe.exe"), Glib::FILE_TEST_EXISTS)) {
ffprobe_exe = X_("C:\\Program Files\\ffmpeg\\ffprobe.exe"); ffprobe_exe = X_("C:\\Program Files\\ffmpeg\\ffprobe.exe");
} }

View file

@ -581,7 +581,7 @@ get_xpm (std::string name)
{ {
if (!xpm_map[name]) { if (!xpm_map[name]) {
SearchPath spath(ARDOUR::ardour_data_search_path()); Searchpath spath(ARDOUR::ardour_data_search_path());
spath.add_subdirectory_to_paths("pixmaps"); spath.add_subdirectory_to_paths("pixmaps");
@ -607,7 +607,7 @@ get_icon_path (const char* cname)
string name = cname; string name = cname;
name += X_(".png"); name += X_(".png");
SearchPath spath(ARDOUR::ardour_data_search_path()); Searchpath spath(ARDOUR::ardour_data_search_path());
spath.add_subdirectory_to_paths("icons"); spath.add_subdirectory_to_paths("icons");

View file

@ -37,10 +37,6 @@
#include "utils_videotl.h" #include "utils_videotl.h"
#include "i18n.h" #include "i18n.h"
#ifdef SearchPath
#undef SearchPath
#endif
using namespace Gtk; using namespace Gtk;
using namespace std; using namespace std;
using namespace PBD; using namespace PBD;
@ -88,7 +84,7 @@ VideoServerDialog::VideoServerDialog (Session* s)
listenaddr_combo.set_active(0); listenaddr_combo.set_active(0);
std::string icsd_file_path; std::string icsd_file_path;
if (find_file_in_search_path (PBD::SearchPath(Glib::getenv("PATH")), X_("harvid"), icsd_file_path)) { if (find_file_in_search_path (PBD::Searchpath(Glib::getenv("PATH")), X_("harvid"), icsd_file_path)) {
path_entry.set_text(icsd_file_path); path_entry.set_text(icsd_file_path);
} }
else if (Glib::file_test(X_("C:\\Program Files\\harvid\\harvid.exe"), Glib::FILE_TEST_EXISTS)) { else if (Glib::file_test(X_("C:\\Program Files\\harvid\\harvid.exe"), Glib::FILE_TEST_EXISTS)) {

View file

@ -719,7 +719,7 @@ VideoTimeLine::find_xjadeo () {
std::string xjadeo_file_path; std::string xjadeo_file_path;
if (getenv("XJREMOTE")) { if (getenv("XJREMOTE")) {
_xjadeo_bin = strdup(getenv("XJREMOTE")); // XXX TODO: free it?! _xjadeo_bin = strdup(getenv("XJREMOTE")); // XXX TODO: free it?!
} else if (find_file_in_search_path (SearchPath(Glib::getenv("PATH")), X_("xjremote"), xjadeo_file_path)) { } else if (find_file_in_search_path (Searchpath(Glib::getenv("PATH")), X_("xjremote"), xjadeo_file_path)) {
_xjadeo_bin = xjadeo_file_path; _xjadeo_bin = xjadeo_file_path;
} }
else if (Glib::file_test(X_("/Applications/Jadeo.app/Contents/MacOS/xjremote"), Glib::FILE_TEST_EXISTS|Glib::FILE_TEST_IS_EXECUTABLE)) { else if (Glib::file_test(X_("/Applications/Jadeo.app/Contents/MacOS/xjremote"), Glib::FILE_TEST_EXISTS|Glib::FILE_TEST_IS_EXECUTABLE)) {

View file

@ -25,15 +25,15 @@
namespace ARDOUR { namespace ARDOUR {
/** /**
* return a SearchPath containing directories in which to look for * return a Searchpath containing directories in which to look for
* control surface plugins. * control surface plugins.
* *
* If ARDOUR_SURFACES_PATH is defined then the SearchPath returned * If ARDOUR_SURFACES_PATH is defined then the Searchpath returned
* will contain only those directories specified in it, otherwise it will * will contain only those directories specified in it, otherwise it will
* contain the user and system directories which may contain control * contain the user and system directories which may contain control
* surface plugins. * surface plugins.
*/ */
PBD::SearchPath control_protocol_search_path (); PBD::Searchpath control_protocol_search_path ();
} // namespace ARDOUR } // namespace ARDOUR

View file

@ -24,10 +24,10 @@
namespace ARDOUR { namespace ARDOUR {
/** /**
* return a SearchPath containing directories in which to look for * return a Searchpath containing directories in which to look for
* export_formats. * export_formats.
*/ */
PBD::SearchPath export_formats_search_path (); PBD::Searchpath export_formats_search_path ();
} // namespace ARDOUR } // namespace ARDOUR

View file

@ -38,10 +38,6 @@
#include "ardour/types.h" #include "ardour/types.h"
#include "ardour/export_handler.h" #include "ardour/export_handler.h"
#ifdef SearchPath
#undef SearchPath
#endif
namespace ARDOUR namespace ARDOUR
{ {
@ -106,7 +102,7 @@ class ExportProfileManager
std::vector<std::string> find_file (std::string const & pattern); std::vector<std::string> find_file (std::string const & pattern);
std::string export_config_dir; std::string export_config_dir;
PBD::SearchPath search_path; PBD::Searchpath search_path;
/* Timespans */ /* Timespans */
public: public:

View file

@ -22,10 +22,6 @@
#include "pbd/search_path.h" #include "pbd/search_path.h"
#ifdef SearchPath
#undef SearchPath
#endif
namespace ARDOUR { namespace ARDOUR {
/** /**
@ -45,14 +41,14 @@ namespace ARDOUR {
* @return the search path to be used when looking for per-system * @return the search path to be used when looking for per-system
* configuration files. This may include user configuration files. * configuration files. This may include user configuration files.
*/ */
PBD::SearchPath ardour_config_search_path (); PBD::Searchpath ardour_config_search_path ();
/** /**
* @return the search path to be used when looking for data files * @return the search path to be used when looking for data files
* that could be shared by systems (h/w and configuration independent * that could be shared by systems (h/w and configuration independent
* files, such as icons, XML files, etc) * files, such as icons, XML files, etc)
*/ */
PBD::SearchPath ardour_data_search_path (); PBD::Searchpath ardour_data_search_path ();
} // namespace ARDOUR } // namespace ARDOUR

View file

@ -25,14 +25,14 @@
namespace ARDOUR { namespace ARDOUR {
/** /**
* return a SearchPath containing directories in which to look for * return a Searchpath containing directories in which to look for
* LADSPA plugins. * LADSPA plugins.
* *
* If LADSPA_PATH is defined then the SearchPath returned * If LADSPA_PATH is defined then the Searchpath returned
* will contain the directories specified in it as well as the * will contain the directories specified in it as well as the
* user and system directories. * user and system directories.
*/ */
PBD::SearchPath ladspa_search_path (); PBD::Searchpath ladspa_search_path ();
} // namespace ARDOUR } // namespace ARDOUR

View file

@ -25,10 +25,10 @@
namespace ARDOUR { namespace ARDOUR {
/** /**
* return a SearchPath containing directories in which to look for * return a Searchpath containing directories in which to look for
* lv2 plugins. * lv2 plugins.
*/ */
PBD::SearchPath lv2_bundled_search_path (); PBD::Searchpath lv2_bundled_search_path ();
} // namespace ARDOUR } // namespace ARDOUR

View file

@ -24,15 +24,15 @@
namespace ARDOUR { namespace ARDOUR {
/** /**
* return a SearchPath containing directories in which to look for * return a Searchpath containing directories in which to look for
* MIDI patch files ("*.midnam") aka MIDNAM files * MIDI patch files ("*.midnam") aka MIDNAM files
* *
* If ARDOUR_MIDI_PATCH_PATH is defined then the SearchPath returned * If ARDOUR_MIDI_PATCH_PATH is defined then the Searchpath returned
* will contain only those directories specified in it, otherwise it will * will contain only those directories specified in it, otherwise it will
* contain the user and system directories which may contain control * contain the user and system directories which may contain control
* surface plugins. * surface plugins.
*/ */
PBD::SearchPath midi_patch_search_path (); PBD::Searchpath midi_patch_search_path ();
} // namespace ARDOUR } // namespace ARDOUR

View file

@ -24,15 +24,15 @@
namespace ARDOUR { namespace ARDOUR {
/** /**
* return a SearchPath containing directories in which to look for * return a Searchpath containing directories in which to look for
* panner plugins. * panner plugins.
* *
* If ARDOUR_PANNER_PATH is defined then the SearchPath returned * If ARDOUR_PANNER_PATH is defined then the Searchpath returned
* will contain only those directories specified in it, otherwise it will * will contain only those directories specified in it, otherwise it will
* contain the user and system directories which may contain control * contain the user and system directories which may contain control
* surface plugins. * surface plugins.
*/ */
PBD::SearchPath panner_search_path (); PBD::Searchpath panner_search_path ();
} // namespace ARDOUR } // namespace ARDOUR

View file

@ -30,10 +30,6 @@
#include "ardour/debug.h" #include "ardour/debug.h"
#include "ardour/control_protocol_manager.h" #include "ardour/control_protocol_manager.h"
#ifdef SearchPath
#undef SearchPath
#endif
#include "ardour/control_protocol_search_path.h" #include "ardour/control_protocol_search_path.h"

View file

@ -33,14 +33,14 @@ using namespace PBD;
namespace ARDOUR { namespace ARDOUR {
SearchPath Searchpath
control_protocol_search_path () control_protocol_search_path ()
{ {
SearchPath spath(user_config_directory ()); Searchpath spath(user_config_directory ());
spath += ardour_dll_directory (); spath += ardour_dll_directory ();
spath.add_subdirectory_to_paths (surfaces_dir_name); spath.add_subdirectory_to_paths (surfaces_dir_name);
spath += SearchPath(Glib::getenv(surfaces_env_variable_name)); spath += Searchpath(Glib::getenv(surfaces_env_variable_name));
return spath; return spath;
} }

View file

@ -32,14 +32,14 @@ using namespace PBD;
namespace ARDOUR { namespace ARDOUR {
SearchPath Searchpath
export_formats_search_path () export_formats_search_path ()
{ {
SearchPath spath (ardour_data_search_path()); Searchpath spath (ardour_data_search_path());
spath.add_subdirectory_to_paths (export_formats_dir_name); spath.add_subdirectory_to_paths (export_formats_dir_name);
bool export_formats_path_defined = false; bool export_formats_path_defined = false;
SearchPath spath_env (Glib::getenv(export_env_variable_name, export_formats_path_defined)); Searchpath spath_env (Glib::getenv(export_env_variable_name, export_formats_path_defined));
if (export_formats_path_defined) { if (export_formats_path_defined) {
spath += spath_env; spath += spath_env;

View file

@ -101,7 +101,7 @@ ardour_dll_directory ()
} }
#ifdef PLATFORM_WINDOWS #ifdef PLATFORM_WINDOWS
SearchPath Searchpath
windows_search_path () windows_search_path ()
{ {
std::string dll_dir_path(g_win32_get_package_installation_directory_of_module(NULL)); std::string dll_dir_path(g_win32_get_package_installation_directory_of_module(NULL));
@ -110,10 +110,10 @@ windows_search_path ()
} }
#endif #endif
SearchPath Searchpath
ardour_config_search_path () ardour_config_search_path ()
{ {
static SearchPath search_path; static Searchpath search_path;
if (search_path.empty()) { if (search_path.empty()) {
search_path += user_config_directory(); search_path += user_config_directory();
@ -126,17 +126,17 @@ ardour_config_search_path ()
::exit (1); ::exit (1);
} }
search_path += SearchPath (s); search_path += Searchpath (s);
#endif #endif
} }
return search_path; return search_path;
} }
SearchPath Searchpath
ardour_data_search_path () ardour_data_search_path ()
{ {
static SearchPath search_path; static Searchpath search_path;
if (search_path.empty()) { if (search_path.empty()) {
search_path += user_config_directory(); search_path += user_config_directory();
@ -149,7 +149,7 @@ ardour_data_search_path ()
::exit (1); ::exit (1);
} }
search_path += SearchPath (s); search_path += Searchpath (s);
#endif #endif
} }

View file

@ -388,7 +388,7 @@ void
ARDOUR::find_bindings_files (map<string,string>& files) ARDOUR::find_bindings_files (map<string,string>& files)
{ {
vector<std::string> found; vector<std::string> found;
SearchPath spath = ardour_config_search_path(); Searchpath spath = ardour_config_search_path();
if (getenv ("ARDOUR_SAE")) { if (getenv ("ARDOUR_SAE")) {
Glib::PatternSpec pattern("*SAE-*.bindings"); Glib::PatternSpec pattern("*SAE-*.bindings");

View file

@ -584,7 +584,7 @@ ARDOUR::set_path_env_for_jack_autostart (const vector<std::string>& dirs)
#ifdef __APPLE__ #ifdef __APPLE__
// push it back into the environment so that auto-started JACK can find it. // push it back into the environment so that auto-started JACK can find it.
// XXX why can't we just expect OS X users to have PATH set correctly? we can't ... // XXX why can't we just expect OS X users to have PATH set correctly? we can't ...
setenv ("PATH", SearchPath(dirs).to_string().c_str(), 1); setenv ("PATH", Searchpath(dirs).to_string().c_str(), 1);
#else #else
(void) dirs; (void) dirs;
#endif #endif
@ -606,7 +606,7 @@ ARDOUR::get_jack_server_dir_paths (vector<std::string>& server_dir_paths)
server_dir_paths.push_back (Glib::path_get_dirname (execpath)); server_dir_paths.push_back (Glib::path_get_dirname (execpath));
#endif #endif
SearchPath sp(string(g_getenv("PATH"))); Searchpath sp(string(g_getenv("PATH")));
#ifdef PLATFORM_WINDOWS #ifdef PLATFORM_WINDOWS
gchar *install_dir = g_win32_get_package_installation_directory_of_module (NULL); gchar *install_dir = g_win32_get_package_installation_directory_of_module (NULL);

View file

@ -33,12 +33,12 @@ using namespace PBD;
namespace ARDOUR { namespace ARDOUR {
SearchPath Searchpath
ladspa_search_path () ladspa_search_path ()
{ {
SearchPath spath_env (Glib::getenv(ladspa_env_variable_name)); Searchpath spath_env (Glib::getenv(ladspa_env_variable_name));
SearchPath spath (user_config_directory ()); Searchpath spath (user_config_directory ());
spath += ardour_dll_directory (); spath += ardour_dll_directory ();
spath.add_subdirectory_to_paths (ladspa_dir_name); spath.add_subdirectory_to_paths (ladspa_dir_name);

View file

@ -29,10 +29,10 @@ using namespace PBD;
namespace ARDOUR { namespace ARDOUR {
SearchPath Searchpath
lv2_bundled_search_path () lv2_bundled_search_path ()
{ {
SearchPath spath( ardour_dll_directory () ); Searchpath spath( ardour_dll_directory () );
spath.add_subdirectory_to_paths ("LV2"); spath.add_subdirectory_to_paths ("LV2");
return spath; return spath;

View file

@ -29,10 +29,6 @@
#include "ardour/session_directory.h" #include "ardour/session_directory.h"
#include "ardour/midi_patch_manager.h" #include "ardour/midi_patch_manager.h"
#ifdef SearchPath
#undef SearchPath
#endif
#include "ardour/midi_patch_search_path.h" #include "ardour/midi_patch_search_path.h"
#include "i18n.h" #include "i18n.h"
@ -107,7 +103,7 @@ MidiPatchManager::refresh()
_master_devices_by_model.clear(); _master_devices_by_model.clear();
_all_models.clear(); _all_models.clear();
SearchPath search_path = midi_patch_search_path (); Searchpath search_path = midi_patch_search_path ();
Glib::PatternSpec pattern (string("*.midnam")); Glib::PatternSpec pattern (string("*.midnam"));
vector<std::string> result; vector<std::string> result;

View file

@ -31,14 +31,14 @@ using namespace PBD;
namespace ARDOUR { namespace ARDOUR {
SearchPath Searchpath
midi_patch_search_path () midi_patch_search_path ()
{ {
SearchPath spath (ardour_data_search_path()); Searchpath spath (ardour_data_search_path());
spath.add_subdirectory_to_paths(midi_patch_dir_name); spath.add_subdirectory_to_paths(midi_patch_dir_name);
bool midi_patch_path_defined = false; bool midi_patch_path_defined = false;
SearchPath spath_env (Glib::getenv(midi_patch_env_variable_name, midi_patch_path_defined)); Searchpath spath_env (Glib::getenv(midi_patch_env_variable_name, midi_patch_path_defined));
if (midi_patch_path_defined) { if (midi_patch_path_defined) {
spath += spath_env; spath += spath_env;

View file

@ -29,10 +29,6 @@
#include "ardour/debug.h" #include "ardour/debug.h"
#include "ardour/panner_manager.h" #include "ardour/panner_manager.h"
#ifdef SearchPath
#undef SearchPath
#endif
#include "ardour/panner_search_path.h" #include "ardour/panner_search_path.h"
#include "i18n.h" #include "i18n.h"

View file

@ -31,14 +31,14 @@ using namespace PBD;
namespace ARDOUR { namespace ARDOUR {
SearchPath Searchpath
panner_search_path () panner_search_path ()
{ {
SearchPath spath(user_config_directory ()); Searchpath spath(user_config_directory ());
spath += ardour_dll_directory (); spath += ardour_dll_directory ();
spath.add_subdirectory_to_paths(panner_dir_name); spath.add_subdirectory_to_paths(panner_dir_name);
spath += SearchPath(Glib::getenv(panner_env_variable_name)); spath += Searchpath(Glib::getenv(panner_env_variable_name));
return spath; return spath;
} }

View file

@ -59,10 +59,6 @@
#include "ardour/plugin_manager.h" #include "ardour/plugin_manager.h"
#include "ardour/rc_configuration.h" #include "ardour/rc_configuration.h"
#ifdef SearchPath
#undef SearchPath
#endif
#include "ardour/ladspa_search_path.h" #include "ardour/ladspa_search_path.h"
#ifdef LV2_SUPPORT #ifdef LV2_SUPPORT

View file

@ -94,10 +94,6 @@
#include "i18n.h" #include "i18n.h"
#ifdef SearchPath
#undef SearchPath
#endif
namespace ARDOUR { namespace ARDOUR {
class MidiSource; class MidiSource;
class Processor; class Processor;
@ -4434,7 +4430,7 @@ Session::end_time_changed (framepos_t old)
std::vector<std::string> std::vector<std::string>
Session::source_search_path (DataType type) const Session::source_search_path (DataType type) const
{ {
SearchPath sp; Searchpath sp;
if (session_dirs.size() == 1) { if (session_dirs.size() == 1) {
switch (type) { switch (type) {
@ -4472,10 +4468,10 @@ Session::source_search_path (DataType type) const
switch (type) { switch (type) {
case DataType::AUDIO: case DataType::AUDIO:
sp += SearchPath(config.get_audio_search_path ()); sp += Searchpath(config.get_audio_search_path ());
break; break;
case DataType::MIDI: case DataType::MIDI:
sp += SearchPath(config.get_midi_search_path ()); sp += Searchpath(config.get_midi_search_path ());
break; break;
} }
@ -4485,7 +4481,7 @@ Session::source_search_path (DataType type) const
void void
Session::ensure_search_path_includes (const string& path, DataType type) Session::ensure_search_path_includes (const string& path, DataType type)
{ {
SearchPath sp; Searchpath sp;
if (path == ".") { if (path == ".") {
return; return;
@ -4493,10 +4489,10 @@ Session::ensure_search_path_includes (const string& path, DataType type)
switch (type) { switch (type) {
case DataType::AUDIO: case DataType::AUDIO:
sp += SearchPath(config.get_audio_search_path ()); sp += Searchpath(config.get_audio_search_path ());
break; break;
case DataType::MIDI: case DataType::MIDI:
sp += SearchPath (config.get_midi_search_path ()); sp += Searchpath (config.get_midi_search_path ());
break; break;
} }

View file

@ -384,7 +384,7 @@ Session::second_stage_init ()
string string
Session::raid_path () const Session::raid_path () const
{ {
SearchPath raid_search_path; Searchpath raid_search_path;
for (vector<space_and_path>::const_iterator i = session_dirs.begin(); i != session_dirs.end(); ++i) { for (vector<space_and_path>::const_iterator i = session_dirs.begin(); i != session_dirs.end(); ++i) {
raid_search_path += (*i).path; raid_search_path += (*i).path;
@ -405,11 +405,11 @@ Session::setup_raid_path (string path)
session_dirs.clear (); session_dirs.clear ();
SearchPath search_path(path); Searchpath search_path(path);
SearchPath sound_search_path; Searchpath sound_search_path;
SearchPath midi_search_path; Searchpath midi_search_path;
for (SearchPath::const_iterator i = search_path.begin(); i != search_path.end(); ++i) { for (Searchpath::const_iterator i = search_path.begin(); i != search_path.end(); ++i) {
sp.path = *i; sp.path = *i;
sp.blocks = 0; // not needed sp.blocks = 0; // not needed
session_dirs.push_back (sp); session_dirs.push_back (sp);

View file

@ -32,27 +32,23 @@
#include "ardour/filename_extensions.h" #include "ardour/filename_extensions.h"
#include "ardour/io.h" #include "ardour/io.h"
#ifdef SearchPath
#undef SearchPath
#endif
using namespace std; using namespace std;
using namespace PBD; using namespace PBD;
namespace ARDOUR { namespace ARDOUR {
SearchPath Searchpath
template_search_path () template_search_path ()
{ {
SearchPath spath (ardour_data_search_path()); Searchpath spath (ardour_data_search_path());
spath.add_subdirectory_to_paths(templates_dir_name); spath.add_subdirectory_to_paths(templates_dir_name);
return spath; return spath;
} }
SearchPath Searchpath
route_template_search_path () route_template_search_path ()
{ {
SearchPath spath (ardour_data_search_path()); Searchpath spath (ardour_data_search_path());
spath.add_subdirectory_to_paths(route_templates_dir_name); spath.add_subdirectory_to_paths(route_templates_dir_name);
return spath; return spath;
} }
@ -101,7 +97,7 @@ find_session_templates (vector<TemplateInfo>& template_names)
{ {
vector<string *> *templates; vector<string *> *templates;
PathScanner scanner; PathScanner scanner;
SearchPath spath (template_search_path()); Searchpath spath (template_search_path());
templates = scanner (spath.to_string(), template_filter, 0, true, true); templates = scanner (spath.to_string(), template_filter, 0, true, true);
@ -137,7 +133,7 @@ find_route_templates (vector<TemplateInfo>& template_names)
{ {
vector<string *> *templates; vector<string *> *templates;
PathScanner scanner; PathScanner scanner;
SearchPath spath (route_template_search_path()); Searchpath spath (route_template_search_path());
templates = scanner (spath.to_string(), route_template_filter, 0, false, true); templates = scanner (spath.to_string(), route_template_filter, 0, false, true);

View file

@ -32,7 +32,7 @@ PluginsTest::test ()
pm.refresh (); pm.refresh ();
SearchPath ladspa_paths(ladspa_search_path ()); Searchpath ladspa_paths(ladspa_search_path ());
cout << "Number of Ladspa paths found: " << ladspa_paths.size () << endl; cout << "Number of Ladspa paths found: " << ladspa_paths.size () << endl;

View file

@ -1,4 +1,4 @@
// this is included first to avoid SearchPath definition on windows // this is included first to avoid Searchpath definition on windows
#include "test_common.h" #include "test_common.h"
#include "pbd/file_utils.h" #include "pbd/file_utils.h"

View file

@ -25,7 +25,7 @@
using namespace std; using namespace std;
PBD::SearchPath PBD::Searchpath
test_search_path () test_search_path ()
{ {
#ifdef PLATFORM_WINDOWS #ifdef PLATFORM_WINDOWS

View file

@ -21,7 +21,7 @@
#include "pbd/search_path.h" #include "pbd/search_path.h"
PBD::SearchPath test_search_path (); PBD::Searchpath test_search_path ();
std::string new_test_output_dir (); std::string new_test_output_dir ();

View file

@ -104,7 +104,7 @@ find_matching_files_in_directories (const vector<std::string>& paths,
} }
void void
find_matching_files_in_search_path (const SearchPath& search_path, find_matching_files_in_search_path (const Searchpath& search_path,
const Glib::PatternSpec& pattern, const Glib::PatternSpec& pattern,
vector<std::string>& result) vector<std::string>& result)
{ {
@ -112,7 +112,7 @@ find_matching_files_in_search_path (const SearchPath& search_path,
} }
bool bool
find_file_in_search_path(const SearchPath& search_path, find_file_in_search_path(const Searchpath& search_path,
const string& filename, const string& filename,
std::string& result) std::string& result)
{ {

View file

@ -68,15 +68,15 @@ find_matching_files_in_directories (const std::vector<std::string>& directory_pa
std::vector<std::string>& result); std::vector<std::string>& result);
/** /**
* Takes a SearchPath and puts a list of all the files in the search path * Takes a Searchpath and puts a list of all the files in the search path
* that match pattern into the result vector. * that match pattern into the result vector.
* *
* @param search_path A SearchPath * @param search_path A Searchpath
* @param pattern A Glib::PatternSpec used to match the files * @param pattern A Glib::PatternSpec used to match the files
* @param result A vector in which to place the resulting matches. * @param result A vector in which to place the resulting matches.
*/ */
void void
find_matching_files_in_search_path (const SearchPath& search_path, find_matching_files_in_search_path (const Searchpath& search_path,
const Glib::PatternSpec& pattern, const Glib::PatternSpec& pattern,
std::vector<std::string>& result); std::vector<std::string>& result);
@ -87,7 +87,7 @@ find_matching_files_in_search_path (const SearchPath& search_path,
* @return true If file is found within the search path. * @return true If file is found within the search path.
*/ */
bool bool
find_file_in_search_path (const SearchPath& search_path, find_file_in_search_path (const Searchpath& search_path,
const std::string& filename, const std::string& filename,
std::string& result); std::string& result);

View file

@ -20,36 +20,32 @@
#ifndef PBD_SEARCH_PATH_INCLUDED #ifndef PBD_SEARCH_PATH_INCLUDED
#define PBD_SEARCH_PATH_INCLUDED #define PBD_SEARCH_PATH_INCLUDED
#ifdef SearchPath
#undef SearchPath
#endif
#include <string> #include <string>
#include <vector> #include <vector>
namespace PBD { namespace PBD {
/** /**
* @class SearchPath * @class Searchpath
* *
* The SearchPath class is a helper class for getting a * The Searchpath class is a helper class for getting a
* vector of paths contained in a search path string where a * vector of paths contained in a search path string where a
* "search path string" contains absolute directory paths * "search path string" contains absolute directory paths
* separated by a colon(:) or a semi-colon(;) on windows. * separated by a colon(:) or a semi-colon(;) on windows.
* *
* The SearchPath class does not test whether the paths exist * The Searchpath class does not test whether the paths exist
* or are directories. It is basically just a container. * or are directories. It is basically just a container.
*/ */
class SearchPath : public std::vector<std::string> class Searchpath : public std::vector<std::string>
{ {
public: public:
/** /**
* Create an empty SearchPath. * Create an empty Searchpath.
*/ */
SearchPath (); Searchpath ();
/** /**
* Initialize SearchPath from a string where the string contains * Initialize Searchpath from a string where the string contains
* one or more absolute paths to directories which are delimited * one or more absolute paths to directories which are delimited
* by a path separation character. The path delimeter is a * by a path separation character. The path delimeter is a
* colon(:) on unix and a semi-colon(;) on windows. * colon(:) on unix and a semi-colon(;) on windows.
@ -59,15 +55,15 @@ public:
* *
* @param search_path A path string. * @param search_path A path string.
*/ */
SearchPath (const std::string& search_path); Searchpath (const std::string& search_path);
/** /**
* Initialize SearchPath from a vector of paths that may or may * Initialize Searchpath from a vector of paths that may or may
* not exist. * not exist.
* *
* @param paths A vector of paths. * @param paths A vector of paths.
*/ */
SearchPath (const std::vector<std::string>& paths); Searchpath (const std::vector<std::string>& paths);
/** /**
* @return a search path string. * @return a search path string.
@ -80,29 +76,29 @@ public:
/** /**
* Add all the directories in path to this. * Add all the directories in path to this.
*/ */
SearchPath& operator+= (const SearchPath& spath); Searchpath& operator+= (const Searchpath& spath);
/** /**
* Add another directory path to the search path. * Add another directory path to the search path.
*/ */
SearchPath& operator+= (const std::string& directory_path); Searchpath& operator+= (const std::string& directory_path);
/** /**
* Concatenate another SearchPath onto this. * Concatenate another Searchpath onto this.
*/ */
SearchPath& operator+ (const SearchPath& other); Searchpath& operator+ (const Searchpath& other);
/** /**
* Add another path to the search path. * Add another path to the search path.
*/ */
SearchPath& operator+ (const std::string& directory_path); Searchpath& operator+ (const std::string& directory_path);
/** /**
* Add a sub-directory to each path in the search path. * Add a sub-directory to each path in the search path.
* @param subdir The directory name, it should not contain * @param subdir The directory name, it should not contain
* any path separating tokens. * any path separating tokens.
*/ */
SearchPath& add_subdirectory_to_paths (const std::string& subdir); Searchpath& add_subdirectory_to_paths (const std::string& subdir);
protected: protected:

View file

@ -37,12 +37,12 @@ const char * const path_delimiter = ":";
namespace PBD { namespace PBD {
SearchPath::SearchPath () Searchpath::Searchpath ()
{ {
} }
SearchPath::SearchPath (const string& path) Searchpath::Searchpath (const string& path)
{ {
vector<std::string> tmp; vector<std::string> tmp;
@ -51,13 +51,13 @@ SearchPath::SearchPath (const string& path)
} }
} }
SearchPath::SearchPath (const vector<std::string>& paths) Searchpath::Searchpath (const vector<std::string>& paths)
{ {
add_directories (paths); add_directories (paths);
} }
void void
SearchPath::add_directory (const std::string& directory_path) Searchpath::add_directory (const std::string& directory_path)
{ {
if (!directory_path.empty()) { if (!directory_path.empty()) {
push_back(directory_path); push_back(directory_path);
@ -65,7 +65,7 @@ SearchPath::add_directory (const std::string& directory_path)
} }
void void
SearchPath::add_directories (const vector<std::string>& paths) Searchpath::add_directories (const vector<std::string>& paths)
{ {
for(vector<std::string>::const_iterator i = paths.begin(); i != paths.end(); ++i) { for(vector<std::string>::const_iterator i = paths.begin(); i != paths.end(); ++i) {
add_directory (*i); add_directory (*i);
@ -73,7 +73,7 @@ SearchPath::add_directories (const vector<std::string>& paths)
} }
const string const string
SearchPath::to_string () const Searchpath::to_string () const
{ {
string path; string path;
@ -87,37 +87,37 @@ SearchPath::to_string () const
return path; return path;
} }
SearchPath& Searchpath&
SearchPath::operator+= (const SearchPath& spath) Searchpath::operator+= (const Searchpath& spath)
{ {
insert(end(), spath.begin(), spath.end()); insert(end(), spath.begin(), spath.end());
return *this; return *this;
} }
SearchPath& Searchpath&
SearchPath::operator+= (const std::string& directory_path) Searchpath::operator+= (const std::string& directory_path)
{ {
add_directory (directory_path); add_directory (directory_path);
return *this; return *this;
} }
SearchPath& Searchpath&
SearchPath::operator+ (const std::string& directory_path) Searchpath::operator+ (const std::string& directory_path)
{ {
add_directory (directory_path); add_directory (directory_path);
return *this; return *this;
} }
SearchPath& Searchpath&
SearchPath::operator+ (const SearchPath& spath) Searchpath::operator+ (const Searchpath& spath)
{ {
// concatenate paths into new SearchPath // concatenate paths into new Searchpath
insert(end(), spath.begin(), spath.end()); insert(end(), spath.begin(), spath.end());
return *this; return *this;
} }
SearchPath& Searchpath&
SearchPath::add_subdirectory_to_paths (const string& subdir) Searchpath::add_subdirectory_to_paths (const string& subdir)
{ {
for (vector<std::string>::iterator i = begin(); i != end(); ++i) { for (vector<std::string>::iterator i = begin(); i != end(); ++i) {
// should these new paths just be added to the end of // should these new paths just be added to the end of

View file

@ -25,7 +25,7 @@
* in an installed location on windows or by setting an environment variable * in an installed location on windows or by setting an environment variable
* on unix. * on unix.
*/ */
PBD::SearchPath PBD::Searchpath
test_search_path () test_search_path ()
{ {
#ifdef PLATFORM_WINDOWS #ifdef PLATFORM_WINDOWS

View file

@ -21,6 +21,6 @@
#include "pbd/search_path.h" #include "pbd/search_path.h"
PBD::SearchPath test_search_path (); PBD::Searchpath test_search_path ();
#endif #endif

View file

@ -106,7 +106,7 @@ static const char * const midimap_env_variable_name = "ARDOUR_MIDIMAPS_PATH";
static const char* const midi_map_dir_name = "midi_maps"; static const char* const midi_map_dir_name = "midi_maps";
static const char* const midi_map_suffix = ".map"; static const char* const midi_map_suffix = ".map";
SearchPath Searchpath
system_midi_map_search_path () system_midi_map_search_path ()
{ {
bool midimap_path_defined = false; bool midimap_path_defined = false;
@ -116,7 +116,7 @@ system_midi_map_search_path ()
return spath_env; return spath_env;
} }
SearchPath spath (ardour_data_search_path()); Searchpath spath (ardour_data_search_path());
spath.add_subdirectory_to_paths(midi_map_dir_name); spath.add_subdirectory_to_paths(midi_map_dir_name);
return spath; return spath;
} }
@ -139,7 +139,7 @@ GenericMidiControlProtocol::reload_maps ()
{ {
vector<string *> *midi_maps; vector<string *> *midi_maps;
PathScanner scanner; PathScanner scanner;
SearchPath spath (system_midi_map_search_path()); Searchpath spath (system_midi_map_search_path());
spath += user_midi_map_directory (); spath += user_midi_map_directory ();
midi_maps = scanner (spath.to_string(), midi_map_filter, 0, false, true); midi_maps = scanner (spath.to_string(), midi_map_filter, 0, false, true);

View file

@ -442,7 +442,7 @@ static const char * const devinfo_env_variable_name = "ARDOUR_MCP_PATH";
static const char* const devinfo_dir_name = "mcp"; static const char* const devinfo_dir_name = "mcp";
static const char* const devinfo_suffix = ".device"; static const char* const devinfo_suffix = ".device";
static SearchPath static Searchpath
devinfo_search_path () devinfo_search_path ()
{ {
bool devinfo_path_defined = false; bool devinfo_path_defined = false;
@ -452,7 +452,7 @@ devinfo_search_path ()
return spath_env; return spath_env;
} }
SearchPath spath (ardour_data_search_path()); Searchpath spath (ardour_data_search_path());
spath.add_subdirectory_to_paths(devinfo_dir_name); spath.add_subdirectory_to_paths(devinfo_dir_name);
return spath; return spath;
@ -472,7 +472,7 @@ DeviceInfo::reload_device_info ()
vector<string> s; vector<string> s;
vector<string *> *devinfos; vector<string *> *devinfos;
PathScanner scanner; PathScanner scanner;
SearchPath spath (devinfo_search_path()); Searchpath spath (devinfo_search_path());
devinfos = scanner (spath.to_string(), devinfo_filter, 0, false, true); devinfos = scanner (spath.to_string(), devinfo_filter, 0, false, true);
device_info.clear (); device_info.clear ();

View file

@ -55,7 +55,7 @@ static const char * const devprofile_env_variable_name = "ARDOUR_MCP_PATH";
static const char* const devprofile_dir_name = "mcp"; static const char* const devprofile_dir_name = "mcp";
static const char* const devprofile_suffix = ".profile"; static const char* const devprofile_suffix = ".profile";
static SearchPath static Searchpath
devprofile_search_path () devprofile_search_path ()
{ {
bool devprofile_path_defined = false; bool devprofile_path_defined = false;
@ -65,7 +65,7 @@ devprofile_search_path ()
return spath_env; return spath_env;
} }
SearchPath spath (ardour_data_search_path()); Searchpath spath (ardour_data_search_path());
spath.add_subdirectory_to_paths(devprofile_dir_name); spath.add_subdirectory_to_paths(devprofile_dir_name);
return spath; return spath;
@ -91,7 +91,7 @@ DeviceProfile::reload_device_profiles ()
vector<string> s; vector<string> s;
vector<string *> *devprofiles; vector<string *> *devprofiles;
PathScanner scanner; PathScanner scanner;
SearchPath spath (devprofile_search_path()); Searchpath spath (devprofile_search_path());
devprofiles = scanner (spath.to_string(), devprofile_filter, 0, false, true); devprofiles = scanner (spath.to_string(), devprofile_filter, 0, false, true);
device_profiles.clear (); device_profiles.clear ();