# HG changeset patch # User Jordi GutiƩrrez Hermoso # Date 1278557759 18000 # Node ID df48b86053de0fd2822a8df9c0de947b67129781 # Parent 82d9efde7e96f6b68c78a6bd71447563c29f5eee Give optional arguments to genpath in order to skip directories with those names diff -r 82d9efde7e96 -r df48b86053de src/load-path.cc --- a/src/load-path.cc Wed Jul 07 15:27:17 2010 -0700 +++ b/src/load-path.cc Wed Jul 07 21:55:59 2010 -0500 @@ -1849,7 +1849,7 @@ file_stat fs (nm); if (fs && fs.is_dir ()) - retval += dir_path::path_sep_str () + genpath (nm); + retval += dir_path::path_sep_str () + genpath (nm, skip); } } } @@ -1895,6 +1895,8 @@ "-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} genpath (@var{dir})\n\ Return a path constructed from @var{dir} and all its subdirectories.\n\ +If additional string parameters are given, the resulting path will \n\ +exclude directories with those names.\ @end deftypefn") { octave_value retval; @@ -1908,6 +1910,19 @@ else error ("genpath: expecting argument to be a character string"); } + else if(args.length() > 1) + { + std::string dirname = args(0).string_value (); + + string_vector skip; + for(octave_idx_type i = 1; i < args.length(); i++) + skip.append(args(i).string_value()); + + if(! error_state) + retval = genpath (dirname, skip); + else + error ("genpath: expecting all arguments to be character strings"); + } else print_usage ();