diff --git a/libinterp/corefcn/fcn-info.cc b/libinterp/corefcn/fcn-info.cc --- a/libinterp/corefcn/fcn-info.cc +++ b/libinterp/corefcn/fcn-info.cc @@ -86,7 +86,7 @@ namespace octave tmpfcn->mark_as_private_function (class_name); - private_functions[octave::sys::canonicalize_file_name (dir_name)] = ov_fcn; + private_functions[octave::sys::env::make_absolute (dir_name)] = ov_fcn; return ov_fcn; } diff --git a/libinterp/corefcn/load-path.cc b/libinterp/corefcn/load-path.cc --- a/libinterp/corefcn/load-path.cc +++ b/libinterp/corefcn/load-path.cc @@ -648,7 +648,7 @@ namespace octave std::string canon_dir = maybe_canonicalize (dir); for (const auto& di : dir_info_list) { - std::string dname = sys::env::make_absolute (di.dir_name); + std::string dname = di.abs_dir_name; size_t dname_len = dname.length (); @@ -695,7 +695,7 @@ namespace octave std::string canon_dir = maybe_canonicalize (dir); for (const auto& di : dir_info_list) { - std::string dname = sys::env::make_absolute (di.dir_name); + std::string dname = di.abs_dir_name; size_t dname_len = dname.length (); @@ -1396,6 +1396,8 @@ namespace octave { is_relative = ! sys::env::absolute_pathname (dir_name); + abs_dir_name = sys::env::make_absolute (dir_name); + dir_time_last_checked = sys::time (static_cast (0)); sys::file_stat fs (dir_name); @@ -1412,13 +1414,11 @@ namespace octave try { - std::string abs_name = sys::env::make_absolute (dir_name); - // FIXME: nothing is ever removed from this cache of // directory information, so there could be some resource // problems. Perhaps it should be pruned from time to time. - abs_dir_cache[abs_name] = *this; + abs_dir_cache[abs_dir_name] = *this; } catch (const execution_exception&) { @@ -1565,7 +1565,7 @@ namespace octave remove_fcn_map (dir, fcn_files); - remove_private_fcn_map (sys::canonicalize_file_name (dir)); + remove_private_fcn_map (di.abs_dir_name); remove_method_map (dir); } @@ -1696,9 +1696,8 @@ namespace octave std::string retval; // update (); - std::string canon_dir = sys::canonicalize_file_name (dir); - - const_private_fcn_map_iterator q = private_fcn_map.find (canon_dir); + + const_private_fcn_map_iterator q = private_fcn_map.find (dir); if (q != private_fcn_map.end ()) { @@ -1709,7 +1708,7 @@ namespace octave if (p != fcn_file_map.end ()) { std::string fname - = sys::file_ops::concat (sys::file_ops::concat (canon_dir, "private"), fcn); + = sys::file_ops::concat (sys::file_ops::concat (dir, "private"), fcn); if (check_file_type (fname, type, p->second, fcn, "load_path::find_private_fcn")) @@ -1717,7 +1716,7 @@ namespace octave } } else - retval = find_private_fcn_file (canon_dir, fcn, type); + retval = find_private_fcn_file (dir, fcn, type); return retval; } @@ -1935,8 +1934,7 @@ namespace octave dir_info::fcn_file_map_type private_file_map = di.private_file_map; if (! private_file_map.empty ()) - private_fcn_map[sys::canonicalize_file_name (di.dir_name)] - = private_file_map; + private_fcn_map[di.abs_dir_name] = private_file_map; } void @@ -1999,8 +1997,12 @@ namespace octave dir_info::fcn_file_map_type private_file_map = ci.private_file_map; if (! private_file_map.empty ()) - private_fcn_map[sys::canonicalize_file_name (full_dir_name)] - = private_file_map; + { + std::string abs_full_dir_name + = sys::file_ops::concat (di.abs_dir_name, '@' + class_name); + + private_fcn_map[abs_full_dir_name] = private_file_map; + } } } @@ -2139,7 +2141,7 @@ namespace octave void load_path::package_info::remove_private_fcn_map (const std::string& dir) { - auto p = private_fcn_map.find (sys::canonicalize_file_name (dir)); + auto p = private_fcn_map.find (dir); if (p != private_fcn_map.end ()) private_fcn_map.erase (p); diff --git a/libinterp/corefcn/symscope.cc b/libinterp/corefcn/symscope.cc --- a/libinterp/corefcn/symscope.cc +++ b/libinterp/corefcn/symscope.cc @@ -30,6 +30,7 @@ #include #include "file-ops.h" +#include "oct-env.h" #include "fcn-info.h" #include "interpreter-private.h" @@ -174,7 +175,7 @@ namespace octave void symbol_scope_rep::cache_dir_name (const std::string& name) { - m_dir_name = octave::sys::canonicalize_file_name (name); + m_dir_name = octave::sys::env::make_absolute (name); } bool