-
Notifications
You must be signed in to change notification settings - Fork 0
/
setupPaths.m
41 lines (36 loc) · 1.07 KB
/
setupPaths.m
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
function setupPaths(varargin)
myPath = fileparts(mfilename('fullpath'));
relPaths = {'blocks/', 'sim-core/', 'sim-core/blocks/', 'tools/input/', 'tools/mex/matlab/', 'rstk/'};
doSave = false;
op = 'add';
for i = 1:nargin
arg = varargin{i};
switch(arg)
case {'add', 'setup', 'install'}
op = 'add';
case {'rm', 'del', 'remove', 'uninstall', 'delete'}
op = 'rm';
case 'save'
doSave = true;
otherwise
error('sim:setupPaths', 'Invalid parameters');
end
end
switch(op)
case 'add'
for i = 1:length(relPaths)
p = fullfile(myPath, relPaths{i});
fprintf('add "%s" to search path\n', p);
addpath(p);
end
case 'rm'
for i = 1:length(relPaths)
p = fullfile(myPath, relPaths{i});
fprintf('remove "%s" from search path\n', p);
rmpath(p);
end
end
if doSave
savepath();
end
end