# HG changeset patch # User jwe # Date 1144179705 0 # Node ID e07baa8b93b9af1c1c6ac03887847f6c76b2a003 # Parent 3a89e82677f06eb8ea5f9312c8dc2001f96d8386 [project @ 2006-04-04 19:41:45 by jwe] diff --git a/scripts/ChangeLog b/scripts/ChangeLog --- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,5 +1,9 @@ 2006-04-04 John W. Eaton + * path/setpath.m: New file. + * path/savepath.m: Use setpath to set path instead of assigning + directly to LOADPATH. + * path/Makefile.in, path/addpath.m, path/rmpath.m, path/savepath.m: New files, adapted from Octave Forge by Keith Goodman . diff --git a/scripts/path/addpath.m b/scripts/path/addpath.m --- a/scripts/path/addpath.m +++ b/scripts/path/addpath.m @@ -17,7 +17,7 @@ ## Based on code Copyright (C) 2000 Etienne Grossmann ## -*- texinfo -*- -## @deftypefn {Function File} {} addpath(@var{dir1}, @dots{}) +## @deftypefn {Function File} {} addpath (@var{dir1}, @dots{}) ## Prepend @var{dir1}, @dots{} to the current @code{LOADPATH}. ## If the directory is already in the path, it is moved to the specified ## location, prepending by default. @@ -33,13 +33,13 @@ ## BUG: This function can't add directories called @samp{-end} or ## @samp{-begin} (case insensitively). ## -## @seealso{LOADPATH, rmpath, savepath} +## @seealso{LOADPATH, rmpath, savepath, setpath} ## @end deftypefn ## Author: Etienne Grossmann ## Modified-By: Bill Denney -##PKGADD: mark_as_command addpath +## PKGADD: mark_as_command addpath function ret = addpath (varargin) diff --git a/scripts/path/rmpath.m b/scripts/path/rmpath.m --- a/scripts/path/rmpath.m +++ b/scripts/path/rmpath.m @@ -18,12 +18,12 @@ ## @deftypefn {Function File} {} rmpath (@var{dir1}, @dots{}) ## Remove @var{dir1}, @dots{} from the current @code{LOADPATH}. ## -## @seealso{LOADPATH, addpath, savepath} +## @seealso{LOADPATH, addpath, savepath, setpath} ## @end deftypefn ## Author: Etienne Grossmann -##PKGADD: mark_as_command rmpath +## PKGADD: mark_as_command rmpath function ret = rmpath (varargin) diff --git a/scripts/path/savepath.m b/scripts/path/savepath.m --- 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 +##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