diff src/fn-cache.cc @ 2233:0da2c91573d9

[project @ 1996-05-17 17:27:17 by jwe]
author jwe
date Fri, 17 May 1996 17:31:30 +0000
parents 834eab508368
children 85185f2a2576
line wrap: on
line diff
--- a/src/fn-cache.cc	Fri May 17 17:11:40 1996 +0000
+++ b/src/fn-cache.cc	Fri May 17 17:31:30 1996 +0000
@@ -40,17 +40,15 @@
 
 // Update the cache.  Returns TRUE if something needed to be updated.
 
-// XXX FIXME XXX -- I suppose we could also keep track of the load
-// path.  Then if a directory is deleted from the load path, we could
-// also delete it from the cache.  Currently, we just accumulate all
-// directories ever referenced in the cache.
+// We just accumulate all directories ever referenced in the cache and
+// we don't delete any old ones.
 
 bool
-octave_fcn_file_name_cache::update (void)
+octave_fcn_file_name_cache::update (const string& path)
 {
   bool retval = false;
 
-  dir_path p (Vload_path);
+  dir_path p = path.empty () ? dir_path (Vload_path) : dir_path (path);
 
   string_vector dirs = p.all_directories ();
 
@@ -79,11 +77,11 @@
 // updated, then return the list of names in the cache.
 
 string_vector
-octave_fcn_file_name_cache::do_list (bool no_suffix)
+octave_fcn_file_name_cache::do_list (const string& path, bool no_suffix)
 {
   // Only recompute the cache if something has changed.
 
-  if (update ())
+  if (update (path))
     {
       int total_len = 0;
 
@@ -130,7 +128,7 @@
 }
 
 string_vector
-octave_fcn_file_name_cache::list (bool no_suffix = false)
+octave_fcn_file_name_cache::list (const string& path, bool no_suffix)
 {
   string_vector retval;
 
@@ -138,7 +136,7 @@
     instance = new octave_fcn_file_name_cache ();
 
   if (instance)
-    retval = instance->do_list (no_suffix);
+    retval = instance->do_list (path, no_suffix);
   else
     panic_impossible ();