Rename PBD::find_file_in_search_path to just PBD::find_file

saves a bit of typing and not necessary if you look at how it is used.
This commit is contained in:
Tim Mayberry 2014-06-19 21:23:12 +10:00 committed by Paul Davis
parent 8d0cba3384
commit cd12698b9c
28 changed files with 45 additions and 45 deletions

View file

@ -565,7 +565,7 @@ About::About ()
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 (spath, "splash.png", splash_file)) {
set_logo (Gdk::Pixbuf::create_from_file (splash_file)); set_logo (Gdk::Pixbuf::create_from_file (splash_file));
} else { } else {
error << "Could not find splash file" << endmsg; error << "Could not find splash file" << endmsg;

View file

@ -76,7 +76,7 @@ ActionManager::load_menus (const string& menus_file)
{ {
std::string ui_file; std::string ui_file;
find_file_in_search_path (ardour_config_search_path(), menus_file, ui_file); find_file (ardour_config_search_path(), menus_file, ui_file);
bool loaded = false; bool loaded = false;

View file

@ -153,7 +153,7 @@ void load_custom_fonts()
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
std::string ardour_mono_file; std::string ardour_mono_file;
if (!find_file_in_search_path (ardour_data_search_path(), "ArdourMono.ttf", ardour_mono_file)) { if (!find_file (ardour_data_search_path(), "ArdourMono.ttf", ardour_mono_file)) {
cerr << _("Cannot find ArdourMono TrueType font") << endl; cerr << _("Cannot find ArdourMono TrueType font") << endl;
} }

View file

@ -151,7 +151,7 @@ load_custom_fonts()
{ {
std::string ardour_mono_file; std::string ardour_mono_file;
if (!find_file_in_search_path (ardour_data_search_path(), "ArdourMono.ttf", ardour_mono_file)) { if (!find_file (ardour_data_search_path(), "ArdourMono.ttf", ardour_mono_file)) {
cerr << _("Cannot find ArdourMono TrueType font") << endl; cerr << _("Cannot find ArdourMono TrueType font") << endl;
} }

View file

@ -238,7 +238,7 @@ string fonts_conf_file;
fonts_conf_file += PROGRAM_NAME; fonts_conf_file += PROGRAM_NAME;
fonts_conf_file += FONTS_CONF_LOCATION; fonts_conf_file += FONTS_CONF_LOCATION;
#else #else
if (PBD::find_file_in_search_path (ARDOUR::ardour_config_search_path(), "fonts.conf", fonts_conf_file)) { if (PBD::find_file (ARDOUR::ardour_config_search_path(), "fonts.conf", fonts_conf_file)) {
#endif #endif
Glib::setenv ("FONTCONFIG_FILE", fonts_conf_file, true); Glib::setenv ("FONTCONFIG_FILE", fonts_conf_file, true);
@ -271,7 +271,7 @@ string pango_modules_file;
#endif #endif
pango_modules_path.resize (pango_modules_path.size()-14); // Remove "/pango.modules" from the end pango_modules_path.resize (pango_modules_path.size()-14); // Remove "/pango.modules" from the end
#else #else
if (PBD::find_file_in_search_path (ARDOUR::ardour_config_search_path(), "pango.modules", pango_modules_file)) { if (PBD::find_file (ARDOUR::ardour_config_search_path(), "pango.modules", pango_modules_file)) {
Glib::ustring pango_modules_path = pango_modules_file; Glib::ustring pango_modules_path = pango_modules_file;
pango_modules_path.resize (pango_modules_path.size()-14); // Remove "/pango.modules" from the end pango_modules_path.resize (pango_modules_path.size()-14); // Remove "/pango.modules" from the end
@ -301,7 +301,7 @@ string gdk_pixbuf_loaders_file;
gdk_pixbuf_loaders_file += PROGRAM_NAME; gdk_pixbuf_loaders_file += PROGRAM_NAME;
gdk_pixbuf_loaders_file += PIXBUFLOADERS_CONF_LOCATION; gdk_pixbuf_loaders_file += PIXBUFLOADERS_CONF_LOCATION;
#else #else
if (PBD::find_file_in_search_path (ARDOUR::ardour_config_search_path(), "gdk-pixbuf.loaders", gdk_pixbuf_loaders_file)) { if (PBD::find_file (ARDOUR::ardour_config_search_path(), "gdk-pixbuf.loaders", gdk_pixbuf_loaders_file)) {
#endif #endif
// Set an environment variable so we can find our pixbuf modules. // Set an environment variable so we can find our pixbuf modules.
Glib::setenv ("GDK_PIXBUF_MODULE_FILE", Glib::filename_from_utf8(gdk_pixbuf_loaders_file), true); Glib::setenv ("GDK_PIXBUF_MODULE_FILE", Glib::filename_from_utf8(gdk_pixbuf_loaders_file), true);
@ -327,7 +327,7 @@ string clearlooks_la_file;
clearlooks_la_file += PROGRAM_NAME; clearlooks_la_file += PROGRAM_NAME;
clearlooks_la_file += CLEARLOOKS_CONF_LOCATION; clearlooks_la_file += CLEARLOOKS_CONF_LOCATION;
#else #else
if (PBD::find_file_in_search_path (ARDOUR::ardour_config_search_path(), "libclearlooks.la", clearlooks_la_file)) { if (PBD::find_file (ARDOUR::ardour_config_search_path(), "libclearlooks.la", clearlooks_la_file)) {
#endif #endif
// Set an environment variable so we can find our clearlooks engine. // Set an environment variable so we can find our clearlooks engine.
// Note that this requires a modified version of libgtk (gtkthemes.c) // Note that this requires a modified version of libgtk (gtkthemes.c)
@ -485,7 +485,7 @@ void load_custom_fonts()
{ {
std::string ardour_mono_file; std::string ardour_mono_file;
if (!find_file_in_search_path (ardour_data_search_path(), "ArdourMono.ttf", ardour_mono_file)) { if (!find_file (ardour_data_search_path(), "ArdourMono.ttf", ardour_mono_file)) {
cerr << _("Cannot find ArdourMono TrueType font") << endl; cerr << _("Cannot find ArdourMono TrueType font") << endl;
} }

View file

@ -706,7 +706,7 @@ Editor::load_bindings ()
std::string binding_file; std::string binding_file;
if (find_file_in_search_path (ardour_config_search_path(), "editor.bindings", binding_file)) { if (find_file (ardour_config_search_path(), "editor.bindings", binding_file)) {
key_bindings.load (binding_file); key_bindings.load (binding_file);
info << string_compose (_("Loaded editor bindings from %1"), binding_file) << endmsg; info << string_compose (_("Loaded editor bindings from %1"), binding_file) << endmsg;
} else { } else {

View file

@ -123,7 +123,7 @@ ArdourKeyboard::setup_keybindings ()
/* not absolute - look in the usual places */ /* not absolute - look in the usual places */
std::string keybindings_file; std::string keybindings_file;
if ( ! find_file_in_search_path (ardour_config_search_path(), keybindings_path, keybindings_file)) { if ( ! find_file (ardour_config_search_path(), keybindings_path, keybindings_file)) {
if (keybindings_path == default_bindings) { if (keybindings_path == default_bindings) {
error << string_compose (_("Default keybindings not found - %1 will be hard to use!"), PROGRAM_NAME) << endmsg; error << string_compose (_("Default keybindings not found - %1 will be hard to use!"), PROGRAM_NAME) << endmsg;

View file

@ -85,7 +85,7 @@ MixerActor::load_bindings ()
std::string binding_file; std::string binding_file;
if (find_file_in_search_path (ardour_config_search_path(), "mixer.bindings", binding_file)) { if (find_file (ardour_config_search_path(), "mixer.bindings", binding_file)) {
bindings.load (binding_file); bindings.load (binding_file);
info << string_compose (_("Loaded mixer bindings from %1"), binding_file) << endmsg; info << string_compose (_("Loaded mixer bindings from %1"), binding_file) << endmsg;
} else { } else {

View file

@ -280,7 +280,7 @@ SessionDialog::setup_initial_choice_box ()
string image_path; string image_path;
if (find_file_in_search_path (ardour_data_search_path(), "small-splash.png", image_path)) { if (find_file (ardour_data_search_path(), "small-splash.png", image_path)) {
Gtk::Image* image; Gtk::Image* image;
if ((image = manage (new Gtk::Image (image_path))) != 0) { if ((image = manage (new Gtk::Image (image_path))) != 0) {
hbox->pack_start (*image, false, false); hbox->pack_start (*image, false, false);

View file

@ -48,7 +48,7 @@ Splash::Splash ()
std::string splash_file; std::string splash_file;
if (!find_file_in_search_path (ardour_data_search_path(), "splash.png", splash_file)) { if (!find_file (ardour_data_search_path(), "splash.png", splash_file)) {
cerr << "Cannot find splash screen image file\n"; cerr << "Cannot find splash screen image file\n";
throw failed_constructor(); throw failed_constructor();
} }

View file

@ -709,7 +709,7 @@ StepEntry::load_bindings ()
std::string binding_file; std::string binding_file;
if (find_file_in_search_path (ardour_config_search_path(), "step_editing.bindings", binding_file)) { if (find_file (ardour_config_search_path(), "step_editing.bindings", binding_file)) {
bindings.load (binding_file); bindings.load (binding_file);
} }
} }

View file

@ -275,7 +275,7 @@ load_rc_file (const string& filename, bool themechange)
{ {
std::string rc_file_path; std::string rc_file_path;
if (!find_file_in_search_path (ardour_config_search_path(), filename, rc_file_path)) { if (!find_file (ardour_config_search_path(), filename, rc_file_path)) {
warning << string_compose (_("Unable to find UI style file %1 in search path %2. %3 will look strange"), warning << string_compose (_("Unable to find UI style file %1 in search path %2. %3 will look strange"),
filename, ardour_config_search_path().to_string(), PROGRAM_NAME) filename, ardour_config_search_path().to_string(), PROGRAM_NAME)
<< endmsg; << endmsg;

View file

@ -52,7 +52,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 (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");
} }
@ -60,7 +60,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 (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

@ -86,7 +86,7 @@ UIConfiguration::load_defaults ()
rcfile = "ardour3_ui_default.conf"; rcfile = "ardour3_ui_default.conf";
} }
if (find_file_in_search_path (ardour_config_search_path(), rcfile, default_ui_rc_file) ) { if (find_file (ardour_config_search_path(), rcfile, default_ui_rc_file) ) {
XMLTree tree; XMLTree tree;
found = 1; found = 1;
@ -117,7 +117,7 @@ UIConfiguration::load_state ()
std::string default_ui_rc_file; std::string default_ui_rc_file;
if ( find_file_in_search_path (ardour_config_search_path(), "ardour3_ui_default.conf", default_ui_rc_file)) { if ( find_file (ardour_config_search_path(), "ardour3_ui_default.conf", default_ui_rc_file)) {
XMLTree tree; XMLTree tree;
found = true; found = true;
@ -138,7 +138,7 @@ UIConfiguration::load_state ()
std::string user_ui_rc_file; std::string user_ui_rc_file;
if (find_file_in_search_path (ardour_config_search_path(), "ardour3_ui.conf", user_ui_rc_file)) { if (find_file (ardour_config_search_path(), "ardour3_ui.conf", user_ui_rc_file)) {
XMLTree tree; XMLTree tree;
found = true; found = true;

View file

@ -666,7 +666,7 @@ get_xpm (std::string name)
std::string data_file_path; std::string data_file_path;
if(!find_file_in_search_path (spath, name, data_file_path)) { if(!find_file (spath, name, data_file_path)) {
fatal << string_compose (_("cannot find XPM file for %1"), name) << endmsg; fatal << string_compose (_("cannot find XPM file for %1"), name) << endmsg;
} }
@ -720,7 +720,7 @@ get_icon_path (const char* cname, string icon_set)
spath.add_subdirectory_to_paths ("icons"); spath.add_subdirectory_to_paths ("icons");
spath.add_subdirectory_to_paths (icon_set); spath.add_subdirectory_to_paths (icon_set);
find_file_in_search_path (spath, name, data_file_path); find_file (spath, name, data_file_path);
} }
if (data_file_path.empty()) { if (data_file_path.empty()) {
@ -732,7 +732,7 @@ get_icon_path (const char* cname, string icon_set)
Searchpath def (ARDOUR::ardour_data_search_path()); Searchpath def (ARDOUR::ardour_data_search_path());
def.add_subdirectory_to_paths ("icons"); def.add_subdirectory_to_paths ("icons");
if (!find_file_in_search_path (def, name, data_file_path)) { if (!find_file (def, name, data_file_path)) {
fatal << string_compose (_("cannot find icon image for %1 using %2"), name, spath.to_string()) << endmsg; fatal << string_compose (_("cannot find icon image for %1 using %2"), name, spath.to_string()) << endmsg;
/*NOTREACHED*/ /*NOTREACHED*/
} }

View file

@ -101,7 +101,7 @@ VideoServerDialog::VideoServerDialog (Session* s)
#endif #endif
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 (PBD::Searchpath(Glib::getenv("PATH")), X_("harvid"), icsd_file_path)) {
path_entry.set_text(icsd_file_path); path_entry.set_text(icsd_file_path);
} }
#ifdef PLATFORM_WINDOWS #ifdef PLATFORM_WINDOWS

View file

@ -735,7 +735,7 @@ VideoTimeLine::find_xjadeo () {
#endif #endif
if (getenv("XJREMOTE")) { if (getenv("XJREMOTE")) {
_xjadeo_bin = getenv("XJREMOTE"); _xjadeo_bin = getenv("XJREMOTE");
} else if (find_file_in_search_path (Searchpath(Glib::getenv("PATH")), X_("xjremote"), xjadeo_file_path)) { } else if (find_file (Searchpath(Glib::getenv("PATH")), X_("xjremote"), xjadeo_file_path)) {
_xjadeo_bin = xjadeo_file_path; _xjadeo_bin = xjadeo_file_path;
} }
#ifdef PLATFORM_WINDOWS #ifdef PLATFORM_WINDOWS

View file

@ -116,7 +116,7 @@ PluginManager::PluginManager ()
string lrdf_path; string lrdf_path;
string scan_p = Glib::build_filename(ARDOUR::ardour_dll_directory(), "fst"); string scan_p = Glib::build_filename(ARDOUR::ardour_dll_directory(), "fst");
if (!PBD::find_file_in_search_path ( PBD::Searchpath(scan_p), "ardour-vst-scanner", scanner_bin_path)) { if (!PBD::find_file ( PBD::Searchpath(scan_p), "ardour-vst-scanner", scanner_bin_path)) {
PBD::warning << "VST scanner app (ardour-vst-scanner) not found in path " << scan_p << endmsg; PBD::warning << "VST scanner app (ardour-vst-scanner) not found in path " << scan_p << endmsg;
} }

View file

@ -76,7 +76,7 @@ RCConfiguration::load_state ()
/* load system configuration first */ /* load system configuration first */
if (find_file_in_search_path (ardour_config_search_path(), "ardour_system.rc", rcfile)) { if (find_file (ardour_config_search_path(), "ardour_system.rc", rcfile)) {
/* stupid XML Parser hates empty files */ /* stupid XML Parser hates empty files */
@ -104,7 +104,7 @@ RCConfiguration::load_state ()
/* now load configuration file for user */ /* now load configuration file for user */
if (find_file_in_search_path (ardour_config_search_path(), "ardour.rc", rcfile)) { if (find_file (ardour_config_search_path(), "ardour.rc", rcfile)) {
/* stupid XML parser hates empty files */ /* stupid XML parser hates empty files */

View file

@ -34,7 +34,7 @@ static char *vfork_exec_wrapper_path() {
return NULL; return NULL;
#else #else
std::string vfork_exec_wrapper; std::string vfork_exec_wrapper;
if (!PBD::find_file_in_search_path ( if (!PBD::find_file (
PBD::Searchpath(Glib::build_filename(ARDOUR::ardour_dll_directory(), "vfork")), PBD::Searchpath(Glib::build_filename(ARDOUR::ardour_dll_directory(), "vfork")),
"ardour-exec-wrapper", vfork_exec_wrapper)) { "ardour-exec-wrapper", vfork_exec_wrapper)) {
PBD::warning << "vfork exec wrapper not found..'" << endmsg; PBD::warning << "vfork exec wrapper not found..'" << endmsg;

View file

@ -19,7 +19,7 @@ ResampledSourceTest::seekTest ()
std::string test_file_path; std::string test_file_path;
const string test_filename = "test.wav"; const string test_filename = "test.wav";
CPPUNIT_ASSERT (find_file_in_search_path (test_search_path (), test_filename, test_file_path)); CPPUNIT_ASSERT (find_file (test_search_path (), test_filename, test_file_path));
boost::shared_ptr<SndFileImportableSource> s (new SndFileImportableSource (test_file_path)); boost::shared_ptr<SndFileImportableSource> s (new SndFileImportableSource (test_file_path));
ResampledImportableSource r (s, 48000, SrcBest); ResampledImportableSource r (s, 48000, SrcBest);

View file

@ -132,7 +132,7 @@ AlsaAudioBackend::acquire_device(const char* device_name)
_reservation_succeeded = false; _reservation_succeeded = false;
std::string request_device_exe; std::string request_device_exe;
if (!PBD::find_file_in_search_path ( if (!PBD::find_file (
PBD::Searchpath(Glib::build_filename(ARDOUR::ardour_dll_directory(), "ardouralsautil") PBD::Searchpath(Glib::build_filename(ARDOUR::ardour_dll_directory(), "ardouralsautil")
+ G_SEARCHPATH_SEPARATOR_S + ARDOUR::ardour_dll_directory()), + G_SEARCHPATH_SEPARATOR_S + ARDOUR::ardour_dll_directory()),
"ardour-request-device", request_device_exe)) "ardour-request-device", request_device_exe))

View file

@ -134,7 +134,7 @@ StatefulImage::find_image (const std::string& name)
std::string path; std::string path;
if (!find_file_in_search_path (_image_search_path, name, path)) { if (!find_file (_image_search_path, name, path)) {
error << string_compose (_("Image named %1 not found"), error << string_compose (_("Image named %1 not found"),
name) << endmsg; name) << endmsg;
return ImageHandle(); return ImageHandle();

View file

@ -147,7 +147,7 @@ find_files_matching_pattern (vector<string>& result,
} }
bool bool
find_file_in_search_path(const Searchpath& search_path, find_file (const Searchpath& search_path,
const string& filename, const string& filename,
std::string& result) std::string& result)
{ {

View file

@ -90,13 +90,13 @@ find_files_matching_pattern (std::vector<std::string>& result,
const std::string& pattern); const std::string& pattern);
/** /**
* Takes a search path and a file name and place the full path * Takes a search path and a file name and places the full path
* to that file in result if it is found within the search path. * to that file in result if it is found within the search path.
* *
* @return true If file is found within the search path. * @return true If file is found within the search path.
*/ */
LIBPBD_API bool LIBPBD_API bool
find_file_in_search_path (const Searchpath& search_path, find_file (const Searchpath& search_path,
const std::string& filename, const std::string& filename,
std::string& result); std::string& result);

View file

@ -195,7 +195,7 @@ SystemExec::SystemExec (std::string command, const std::map<char, std::string> s
{ {
init (); init ();
make_argp_escaped(command, subs); make_argp_escaped(command, subs);
if (!find_file_in_search_path (Searchpath (Glib::getenv ("PATH")), argp[0], cmd)) { if (!find_file (Searchpath (Glib::getenv ("PATH")), argp[0], cmd)) {
// not found in path - use as-is // not found in path - use as-is
cmd = argp[0]; cmd = argp[0];
} }

View file

@ -18,7 +18,7 @@ XPathTest::testMisc ()
// cout << "Test 1: RosegardenPatchFile.xml: Find all banks in the file" << endl; // cout << "Test 1: RosegardenPatchFile.xml: Find all banks in the file" << endl;
std::string testdata_path; std::string testdata_path;
CPPUNIT_ASSERT (find_file_in_search_path (test_search_path (), "RosegardenPatchFile.xml", testdata_path)); CPPUNIT_ASSERT (find_file (test_search_path (), "RosegardenPatchFile.xml", testdata_path));
XMLTree doc(testdata_path); XMLTree doc(testdata_path);
// "//bank" gives as last element an empty element libxml bug???? // "//bank" gives as last element an empty element libxml bug????
@ -51,7 +51,7 @@ XPathTest::testMisc ()
// We have to allocate a new document here, or we get segfaults // We have to allocate a new document here, or we get segfaults
std::string testsession_path; std::string testsession_path;
CPPUNIT_ASSERT (find_file_in_search_path (test_search_path (), "TestSession.ardour", testsession_path)); CPPUNIT_ASSERT (find_file (test_search_path (), "TestSession.ardour", testsession_path));
XMLTree doc2(testsession_path); XMLTree doc2(testsession_path);
result = doc2.find("/Session/Sources/Source[contains(@captured-for, 'Guitar')]"); result = doc2.find("/Session/Sources/Source[contains(@captured-for, 'Guitar')]");
@ -77,7 +77,7 @@ XPathTest::testMisc ()
// cout << endl << endl << "Test 5: ProtoolsPatchFile.midnam: Get Banks and Patches for 'Name Set 1'" << endl; // cout << endl << endl << "Test 5: ProtoolsPatchFile.midnam: Get Banks and Patches for 'Name Set 1'" << endl;
std::string testmidnam_path; std::string testmidnam_path;
CPPUNIT_ASSERT (find_file_in_search_path (test_search_path (), "ProtoolsPatchFile.midnam", testmidnam_path)); CPPUNIT_ASSERT (find_file (test_search_path (), "ProtoolsPatchFile.midnam", testmidnam_path));
// We have to allocate a new document here, or we get segfaults // We have to allocate a new document here, or we get segfaults
XMLTree doc3(testmidnam_path); XMLTree doc3(testmidnam_path);

View file

@ -205,7 +205,7 @@ OSC::start ()
std::string url_file; std::string url_file;
if (find_file_in_search_path (ardour_config_search_path(), "osc_url", url_file)) { if (find_file (ardour_config_search_path(), "osc_url", url_file)) {
_osc_url_file = url_file; _osc_url_file = url_file;
ofstream urlfile; ofstream urlfile;