-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathmake.m
More file actions
executable file
·48 lines (41 loc) · 1.19 KB
/
make.m
File metadata and controls
executable file
·48 lines (41 loc) · 1.19 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
function make(varargin)
if nargin == 0
disp('At the MATLAB command prompt:');
disp(' make update (update tools)');
disp(' make install (add tools to MATLAB path)');
return;
end
dirbase = fileparts(mfilename('fullpath'));
[~, dirs] = calcdeps;
for command = varargin
switch command{1}
case 'install'
targs = dirs;
quatloc = which('angle2quat');
ourloc = fullfile(dirbase, 'quaternions');
if ~isempty(quatloc) && ~strncmp(ourloc, quatloc, length(ourloc))
targs = setdiff(targs, 'quaternions');
end
pathitems = regexp(path, '(?:^|:)([^:]+)(?:$|:)', 'tokens');
for target = targs
fulldir = fullfile(dirbase, target{1});
if ~any(strcmp(fulldir, pathitems))
addpath(fulldir);
savepath;
fprintf('Added %s to path\n', target{1});
end
end
case 'update'
fprintf('Updating... ');
[status, output] = system('git pull');
if status == 0
fprintf('done.\n');
fprintf('%s', output);
else
fprintf('error!\n');
fprintf('%s', output);
error('Error during update, see above for details.');
end
end
end
end