Mercurial > hg > octave-terminal
changeset 5919:ceaf10a4743c
[project @ 2006-08-14 16:42:02 by jwe]
author | jwe |
---|---|
date | Mon, 14 Aug 2006 16:42:03 +0000 |
parents | 84dc6800fcd8 |
children | bf4241378994 |
files | src/ChangeLog src/load-path.cc |
diffstat | 2 files changed, 23 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2006-08-14 John W. Eaton <jwe@octave.org> + + * load-path.cc (load_path::find_dir_info, load_path::do_add, + load_path::do_remove): Perform tilde expansion on directory here. + 2006-07-29 John W. Eaton <jwe@octave.org> * matrix.h: Delete to avoid conflict with liboctave/Matrix.h on
--- a/src/load-path.cc +++ b/src/load-path.cc @@ -237,8 +237,10 @@ } load_path::const_dir_info_list_iterator -load_path::find_dir_info (const std::string& dir) const +load_path::find_dir_info (const std::string& dir_arg) const { + std::string dir = file_ops::tilde_expand (dir_arg); + const_dir_info_list_iterator retval = dir_info_list.begin (); while (retval != dir_info_list.end ()) @@ -253,8 +255,10 @@ } load_path::dir_info_list_iterator -load_path::find_dir_info (const std::string& dir) +load_path::find_dir_info (const std::string& dir_arg) { + std::string dir = file_ops::tilde_expand (dir_arg); + dir_info_list_iterator retval = dir_info_list.begin (); while (retval != dir_info_list.end ()) @@ -465,14 +469,16 @@ } void -load_path::do_add (const std::string& dir, bool at_end, bool warn) +load_path::do_add (const std::string& dir_arg, bool at_end, bool warn) { - size_t len = dir.length (); + size_t len = dir_arg.length (); - if (len > 1 && dir.substr (len-2) == "//") + if (len > 1 && dir_arg.substr (len-2) == "//") warning_with_id ("Octave:recursive-path-search", "trailing `//' is no longer special in search path elements"); + std::string dir = file_ops::tilde_expand (dir_arg); + dir_info_list_iterator i = find_dir_info (dir); if (i != dir_info_list.end ()) @@ -501,12 +507,12 @@ } } else if (warn) - warning ("addpath: %s: not a directory", dir.c_str ()); + warning ("addpath: %s: not a directory", dir_arg.c_str ()); } else if (warn) { std::string msg = fs.error (); - warning ("addpath: %s: %s", dir.c_str (), msg.c_str ()); + warning ("addpath: %s: %s", dir_arg.c_str (), msg.c_str ()); } } @@ -521,13 +527,13 @@ } bool -load_path::do_remove (const std::string& dir) +load_path::do_remove (const std::string& dir_arg) { bool retval = false; - if (! dir.empty ()) + if (! dir_arg.empty ()) { - if (dir == ".") + if (dir_arg == ".") { warning ("rmpath: can't remove \".\" from path"); @@ -536,6 +542,8 @@ } else { + std::string dir = file_ops::tilde_expand (dir_arg); + dir_info_list_iterator i = find_dir_info (dir); if (i != dir_info_list.end ())