diff scripts/path/savepath.m @ 5736:e07baa8b93b9

[project @ 2006-04-04 19:41:45 by jwe]
author jwe
date Tue, 04 Apr 2006 19:41:45 +0000
parents 3a89e82677f0
children 296cefb48d7e
line wrap: on
line diff
--- a/scripts/path/savepath.m
+++ b/scripts/path/savepath.m
@@ -25,11 +25,13 @@
 ##
 ## It will return 0 if it was successful.
 ##
-## @seealso{LOADPATH, addpath, rmpath}
+## @seealso{LOADPATH, addpath, rmpath, setpath}
 ## @end deftypefn
 
 ## Author: Bill Denney <bill@givebillmoney.com>
 
+##PKGADD: mark_as_command savepath
+
 function varargout = savepath (savefile)
 
   retval = 1;
@@ -79,9 +81,6 @@
     error ("savepath: unable to parse file, %s", savefile);
   endif
 
-  ## put the path into a cell array
-  pathlines = { beginstring, ["  LOADPATH=\"", LOADPATH, "\";"], endstring };
-
   ## put the current savepath lines into the file
   if (isempty (filelines)
       || (startline == 1 && endline == length (filelines)))
@@ -111,9 +110,10 @@
   for i = 1:length (pre)
     fprintf (fid, "%s\n", pre{i})
   endfor
-  for i = 1:length (pathlines)
-    fprintf (fid, "%s\n", pathlines{i});
-  endfor
+
+  fprintf (fid, "%s\n  setpath (\"%s\");\n%s\n",
+	   beginstring, LOADPATH, endstring);
+
   for i = 1:length (post)
     fprintf (fid, "%s\n", post{i});
   endfor