Mercurial > hg > octave-nkf
changeset 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 | c70bfdf5b2c5 |
files | scripts/ChangeLog scripts/path/addpath.m scripts/path/rmpath.m scripts/path/savepath.m |
diffstat | 4 files changed, 16 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,5 +1,9 @@ 2006-04-04 John W. Eaton <jwe@octave.org> + * 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 <kwgoodman@gmail.com>.
--- 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 <etienne@cs.uky.edu> ## Modified-By: Bill Denney <bill@givebillmoney.com> -##PKGADD: mark_as_command addpath +## PKGADD: mark_as_command addpath function ret = addpath (varargin)
--- 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 <etienne@cs.uky.edu> -##PKGADD: mark_as_command rmpath +## PKGADD: mark_as_command rmpath function ret = rmpath (varargin)
--- 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