/usr/share/freemat/toolbox/util/addpath.m is in freemat-data 4.0-5build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | % ADDPATH ADDPATH Add
%
% Usage
%
% The addpath routine adds a set of directories to the current path.
% The first form takes a single directory and adds it to the beginning
% or top of the path:
%
% addpath('directory')
%
% The second form add several directories to the top of the path:
%
% addpath('dir1','dir2',...,'dirn')
%
% Finally, you can provide a flag to control where the directories get
% added to the path
%
% addpath('dir1','dir2',...,'dirn','-flag')
%
% where if flag is either '-0' or '-begin', the directories are
% added to the top of the path, and if the flag is either '-1' or
% '-end' the directories are added to the bottom (or end) of the path.
% Copyright (c) 2002-2007 Samit Basu
% Licensed under the GPL
function addpath(varargin)
if (nargin == 0) return; end
atbegin = 1;
if (any(strcmp(varargin{end},{'-0','-begin'})))
varargin(end) = [];
elseif (any(strcmp(varargin{end},{'-1','-end'})))
atbegin = 0;
varargin(end) = [];
end
if (atbegin)
g = [];
for i=1:numel(varargin)
g = [g,varargin{i},pathsep];
end
g = [g,getpath];
setpath(g);
else
g = getpath;
for i=1:numel(varargin)
g = [g,pathsep,varargin{i}];
end
setpath(g);
end
|