changeset 18633:348f67886dc4

hgload.m: Check for file with .ofig extension before bare file name (bug #41978). * hgload.m: Check for file with .ofig extension before bare file name.
author Rik <rik@octave.org>
date Fri, 28 Mar 2014 08:47:55 -0700
parents 29f00c0d0657
children cdc16fbb513f
files scripts/plot/util/hgload.m
diffstat 1 files changed, 8 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/plot/util/hgload.m	Tue Mar 25 17:00:41 2014 +0000
+++ b/scripts/plot/util/hgload.m	Fri Mar 28 08:47:55 2014 -0700
@@ -33,18 +33,21 @@
   if (nargin != 1)
     print_usage ();
   endif
-  
+
   ## Check file existence
-  if (isempty (file_in_loadpath (filename)))
-    [~, ~, ext] = fileparts (filename);
-    if (isempty (ext))
+  [~, ~, ext] = fileparts (filename);
+  if (isempty (ext))
+    if (! isempty (file_in_loadpath ([filename ".ofig"])))
       filename = [filename ".ofig"];
+    elseif (isempty (file_in_loadpath (filename)))
+      error ("hgload: unable to locate file %s", filename);
     endif
+  else
     if (isempty (file_in_loadpath (filename)))
       error ("hgload: unable to locate file %s", filename);
     endif
   endif
-
+    
   ## Load the handle
   try
     stmp = load (filename, "s_oct40");