mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-07 23:35:03 +01:00
Use run_functor_for_paths in PBD::get_paths
This commit is contained in:
parent
ba484f1e1f
commit
851db83fc4
1 changed files with 8 additions and 41 deletions
|
|
@ -133,47 +133,20 @@ run_functor_for_paths (vector<string>& result,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
bool accept_all_files (string const &, void *)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
get_paths (vector<string>& result,
|
get_paths (vector<string>& result,
|
||||||
const std::string& directory_path,
|
const std::string& directory_path,
|
||||||
bool files_only,
|
bool files_only,
|
||||||
bool recurse)
|
bool recurse)
|
||||||
{
|
{
|
||||||
// perhaps we don't need this check assuming an exception is thrown
|
run_functor_for_paths (result, directory_path, accept_all_files, 0,
|
||||||
// as it would save checking that the path is a directory twice when
|
files_only, true, true, recurse);
|
||||||
// recursing
|
|
||||||
if (!Glib::file_test (directory_path, Glib::FILE_TEST_IS_DIR)) return;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Glib::Dir dir(directory_path);
|
|
||||||
Glib::DirIterator i = dir.begin();
|
|
||||||
|
|
||||||
while (i != dir.end()) {
|
|
||||||
|
|
||||||
string fullpath = Glib::build_filename (directory_path, *i);
|
|
||||||
|
|
||||||
bool is_dir = Glib::file_test (fullpath, Glib::FILE_TEST_IS_DIR);
|
|
||||||
|
|
||||||
if (is_dir && recurse) {
|
|
||||||
DEBUG_TRACE (DEBUG::FileUtils,
|
|
||||||
string_compose("Descending into directory: %1\n",
|
|
||||||
fullpath));
|
|
||||||
get_paths (result, fullpath, files_only, recurse);
|
|
||||||
}
|
|
||||||
|
|
||||||
i++;
|
|
||||||
|
|
||||||
if (is_dir && files_only) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
result.push_back (fullpath);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Glib::FileError& err)
|
|
||||||
{
|
|
||||||
warning << err.what() << endmsg;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -361,12 +334,6 @@ copy_error:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
|
||||||
bool accept_all_files (string const &, void *)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
copy_files(const std::string & from_path, const std::string & to_dir)
|
copy_files(const std::string & from_path, const std::string & to_dir)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue