# HG changeset patch # User jwe # Date 1155573723 0 # Node ID ceaf10a4743ca5178cc111e24c71e271f1ef662c # Parent 84dc6800fcd89a14445ee1ea5ab0b1c2b9a9e9b1 [project @ 2006-08-14 16:42:02 by jwe] diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2006-08-14 John W. Eaton + + * 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 * matrix.h: Delete to avoid conflict with liboctave/Matrix.h on diff --git a/src/load-path.cc b/src/load-path.cc --- 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 ())