Mercurial > hg > octave-nkf
diff src/load-path.cc @ 9261:95445f9f5976
omit file extensions from __list_functions__ output
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 26 May 2009 12:00:00 -0400 |
parents | 9b12ed1fbbbd |
children | 2ed8d2d92507 |
line wrap: on
line diff
--- a/src/load-path.cc +++ b/src/load-path.cc @@ -1337,7 +1337,7 @@ } string_vector -load_path::do_files (const std::string& dir) const +load_path::do_files (const std::string& dir, bool omit_exts) const { string_vector retval; @@ -1346,6 +1346,21 @@ if (i != dir_info_list.end ()) retval = i->fcn_files; + if (omit_exts) + { + octave_idx_type len = retval.length (); + + for (octave_idx_type i = 0; i < len; i++) + { + std::string fname = retval[i]; + + size_t pos = fname.rfind ('.'); + + if (pos != std::string::npos) + retval[i] = fname.substr (0, pos); + } + } + return retval; }