Change PBD::get_files and PBD::get_paths to take a Searchpath instead of directory...
authorTim Mayberry <mojofunk@gmail.com>
Sun, 22 Jun 2014 09:58:19 +0000 (19:58 +1000)
committerPaul Davis <paul@linuxaudiosystems.com>
Wed, 25 Jun 2014 16:40:11 +0000 (12:40 -0400)
Both these functions use the internal function run_functor_for_paths
which takes a Searchpath so this avoids a temporary variable in cases
where a Searchpath is passed directly.

The usage is the same as the compiler will generate a temporary Searchpath
from a string(directory path) if necessary.

libs/pbd/file_utils.cc
libs/pbd/pbd/file_utils.h

index 8338058707ff3db9ea771c0ed83befb868066ae5..f4efea00f3a3785dac03e0a33f795ec1fd3e7a0c 100644 (file)
@@ -141,18 +141,18 @@ bool accept_all_files (string const &, void *)
 
 void
 get_paths (vector<string>& result,
-           const std::string& directory_path,
+           const Searchpath& paths,
            bool files_only,
            bool recurse)
 {
-       run_functor_for_paths (result, directory_path, accept_all_files, 0,
+       run_functor_for_paths (result, paths, accept_all_files, 0,
                               files_only, true, true, recurse);
 }
 
 void
-get_files (vector<string>& result, const std::string& directory_path)
+get_files (vector<string>& result, const Searchpath& paths)
 {
-       return get_paths (result, directory_path, true, false);
+       return get_paths (result, paths, true, false);
 }
 
 static
index 52436d123402dd5f7f4bcdef851ed9f42ed6e790..9ef5374a0a5e70c6da4ca9087f785ca119b2794e 100644 (file)
@@ -35,28 +35,28 @@ namespace PBD {
  * if recursing.
  * @note paths in result will be absolute
  *
- * @param path An absolute path to a directory in the filename encoding
  * @param result A vector of absolute paths to the directory entries in filename
  * encoding.
+ * @param paths A Searchpath
  * @param files_only Only include file entries in result
  * @param recurse Recurse into child directories
  */
 LIBPBD_API void
 get_paths (std::vector<std::string>& result,
-           const std::string& directory_path,
+           const Searchpath& paths,
            bool files_only = true,
            bool recurse = false);
 
 /**
- * Get a list of files in a directory.
+ * Get a list of files in a Searchpath.
  * @note paths in result will be absolute.
  *
- * @param path An Absolute path to a directory
+ * @param path A Searchpath
  * @param result A vector of paths to files.
  */
 LIBPBD_API void
 get_files (std::vector<std::string>& result,
-           const std::string& path);
+           const Searchpath& paths);
 
 /**
  * Takes a Searchpath and returns all the files contained in the