-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsetup.m
More file actions
61 lines (47 loc) · 1.83 KB
/
setup.m
File metadata and controls
61 lines (47 loc) · 1.83 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
function setup(str1,str2)
rootDir = pwd;
addpath(pwd)
srcPath = genpath([rootDir '/src']); % all src live here for this project
libsPath = genpath([rootDir '/lib']); % all libs/dependencies live here for this project
resPath = genpath([rootDir '/res']); % all libs/dependencies live here for this project
if nargin > 0
switch str1
case 'install'
addpath(srcPath, '-begin');
addpath(libsPath, '-begin');
addpath(resPath, '-begin');
disp('Successfully added package to path.')
statusStr = [str1 'ed'];
case 'remove'
warning('off')
rmpath(libsPath);
disp('Successfully removed package from path.')
warning('on')
statusStr = [str1 'd'];
otherwise
disp('Unrecognized arg 1. Try >> setup add OR >> setup remove.')
disp('Setup incomplete.')
return
end
if nargin > 1
switch str2
case 'save'
warning('You are about to make permanent changes to search path.')
prompt = 'Would you like to continue? (y/n): ';
str = input(prompt,'s');
if strcmp(str, 'y')
savepath
disp(['Permanently ' statusStr ' project libs on search path.'])
elseif strcmp(str, 'n')
disp('Canceling permanent save.')
else
disp('Unrecognized input. Exiting without saving path')
return
end
otherwise
disp('Unrecognized arg 2. Try >> setup add save OR >> setup remove save.')
return
end
end
else
end