diff --git a/gtk2_ardour/utils.cc b/gtk2_ardour/utils.cc index 82397a325d..c3d02dee2f 100644 --- a/gtk2_ardour/utils.cc +++ b/gtk2_ardour/utils.cc @@ -696,13 +696,8 @@ get_icon_sets () get_files_in_directory (*s, entries); for (vector::iterator e = entries.begin(); e != entries.end(); ++e) { - - string d = *e; - - Glib::ustring path = Glib::build_filename (*s, *e); - - if (Glib::file_test (path, Glib::FILE_TEST_IS_DIR)) { - r.push_back (Glib::filename_to_utf8 (*e)); + if (Glib::file_test (*e, Glib::FILE_TEST_IS_DIR)) { + r.push_back (Glib::filename_to_utf8 (Glib::path_get_basename(*e))); } } } diff --git a/libs/pbd/file_utils.cc b/libs/pbd/file_utils.cc index bdc03dc143..6e81a213f5 100644 --- a/libs/pbd/file_utils.cc +++ b/libs/pbd/file_utils.cc @@ -107,17 +107,7 @@ get_directory_contents (const std::string& directory_path, void get_files_in_directory (const std::string& directory_path, vector& result) { - if (!Glib::file_test (directory_path, Glib::FILE_TEST_IS_DIR)) return; - - try - { - Glib::Dir dir(directory_path); - std::copy(dir.begin(), dir.end(), std::back_inserter(result)); - } - catch (Glib::FileError& err) - { - warning << err.what() << endmsg; - } + return get_directory_contents (directory_path, result, true, false); } void @@ -134,17 +124,15 @@ find_matching_files_in_directory (const std::string& directory, file_iter != tmp_files.end(); ++file_iter) { - if (!pattern.match(*file_iter)) continue; - - std::string full_path(directory); - full_path = Glib::build_filename (full_path, *file_iter); + string filename = Glib::path_get_basename (*file_iter); + if (!pattern.match(filename)) continue; DEBUG_TRACE ( DEBUG::FileUtils, - string_compose("Found file %1\n", full_path) + string_compose("Found file %1\n", *file_iter) ); - result.push_back(full_path); + result.push_back(*file_iter); } }