changeset 5472:e2f85b298a74

[project @ 2005-09-23 21:10:36 by jwe]
author jwe
date Fri, 23 Sep 2005 21:10:36 +0000
parents 764a4349e492
children 3e4564ddd985
files src/ChangeLog src/parse.y
diffstat 2 files changed, 22 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Fri Sep 23 20:06:35 2005 +0000
+++ b/src/ChangeLog	Fri Sep 23 21:10:36 2005 +0000
@@ -1,5 +1,8 @@
 2005-09-23  John W. Eaton  <jwe@octave.org>
 
+	* parse.y (load_fcn_from_file): Don't look in path if file is
+	absolute and has .oct or .m extension.
+
 	* utils.cc (Ferrno_list): New function.
 
 	* oct-errno.h, oct-errno.cc.in: New files.
--- a/src/parse.y	Fri Sep 23 20:06:35 2005 +0000
+++ b/src/parse.y	Fri Sep 23 21:10:36 2005 +0000
@@ -3362,12 +3362,25 @@
 
   string_vector names (2);
 
-  names[0] = nm + ".oct";
-  names[1] = nm + ".m";
-
-  std::string file
-   = octave_env::make_absolute (Vload_path_dir_path.find_first_of (names),
-                                octave_env::getcwd ());
+  int nm_len = nm.length ();
+
+  std::string file;
+
+  if (octave_env::absolute_pathname (nm)
+      && ((nm_len > 4 && nm.substr (nm_len-4) == ".oct")
+	  || (nm_len > 2 && nm.substr (nm_len-4) == ".m")))
+    {
+      file = nm;
+    }
+  else
+    {
+      names[0] = nm + ".oct";
+      names[1] = nm + ".m";
+
+      file
+	= octave_env::make_absolute (Vload_path_dir_path.find_first_of (names),
+				     octave_env::getcwd ());
+    }
 
   int len = file.length ();