diff src/utils.cc @ 5864:e884ab4f29ee

[project @ 2006-06-22 00:57:27 by jwe]
author jwe
date Thu, 22 Jun 2006 00:57:28 +0000
parents 5e41e06f6a78
children e8868fde0fc5
line wrap: on
line diff
--- a/src/utils.cc
+++ b/src/utils.cc
@@ -433,7 +433,7 @@
   return retval;
 }
 
-// See if there is an octave file in the path.  If so, return the
+// See if there is a .oct file in the path.  If so, return the
 // full path to the file.
 
 std::string
@@ -462,6 +462,35 @@
   return retval;
 }
 
+// See if there is a .mex file in the path.  If so, return the
+// full path to the file.
+
+std::string
+mex_file_in_path (const std::string& name)
+{
+  std::string retval;
+
+  int len = name.length ();
+  
+  if (len > 0)
+    {
+      if (octave_env::absolute_pathname (name))
+	{
+	  file_stat fs (name);
+
+	  if (fs.exists ())
+	    retval = name;
+	}
+      else if (len > 4 && name [len - 4] == '.' && name [len - 3] == 'm'
+	       && name [len - 2] == 'e' && name [len - 1] == 'x')
+	retval = load_path::find_mex_file (name.substr (0, len-4));
+      else
+	retval = load_path::find_mex_file (name);
+    }
+
+  return retval;
+}
+
 // Replace backslash escapes in a string with the real values.
 
 std::string