diff src/utils.cc @ 11814:2ca993580aca release-3-0-x

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
parents a1dbe9d80eee
children d1b8260dbc76
line wrap: on
line diff
--- a/src/utils.cc
+++ b/src/utils.cc
@@ -746,6 +746,28 @@
 	    error ("errno: expecting integer argument");
 	}
     }
+
+  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 ());
+    }
   else if (nargin == 0)
     retval = octave_errno::get ();
   else