diff src/utils.cc @ 8041:a14bdf90be55

Add a search for Contents.m files to the help function
author David Bateman <dbateman@free.fr>
date Tue, 19 Aug 2008 16:15:52 -0400 (2008-08-19)
parents 85184151822e
children 1bf51192fa1d
line wrap: on
line diff
--- a/src/utils.cc
+++ b/src/utils.cc
@@ -448,6 +448,28 @@
   return retval;
 }
 
+// See if there is a directory called "name" in the path and if it
+// contains a Contents.m file return the full path to this file.
+
+std::string
+contents_file_in_path (const std::string& dir)
+{
+  std::string retval;
+
+  if (dir.length () > 0)
+    {
+      std::string tcontents = file_ops::concat (load_path::find_dir (dir), 
+						std::string ("Contents.m"));
+
+      file_stat fs (tcontents);
+
+      if (fs.exists ())
+	retval = octave_env::make_absolute (tcontents, octave_env::getcwd ());
+    }
+
+  return retval;
+}
+
 // See if there is a .oct file in the path.  If so, return the
 // full path to the file.