Mercurial > repos > public > matlab_path_manager
comparison +mpm/verify.m @ 7:309cc6c0cd75
Change names in ui
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Mon, 10 Sep 2018 17:05:03 +0200 |
parents | +mpm/check.m@19c4af287596 |
children | 02c290e2018c |
comparison
equal
deleted
inserted
replaced
6:19c4af287596 | 7:309cc6c0cd75 |
---|---|
1 % Check if the current proejct settings are correct | |
2 % The right version is in the path | |
3 % The right version is at the top of the path | |
4 % | |
5 % Useful to put at the top of some scripts | |
6 function check() | |
7 if ~exist('d', 'var') || isempty(d) | |
8 d = ''; | |
9 end | |
10 | |
11 folders = split(path(), pathsep); | |
12 | |
13 sp = mpm.subpaths(d); | |
14 for i = 1:length(sp) | |
15 if ~isAtTop(sp{i}, fullfile(pwd, sp{i}), folders) | |
16 error('Subpaths are not correctly set. Try running mpm.set()'); | |
17 end | |
18 end | |
19 end | |
20 | |
21 function b = isAtTop(subpath, fullsubpath, paths) | |
22 for i = 1:length(paths) | |
23 if ~endsWith(paths{i}, subpath) | |
24 continue | |
25 end | |
26 | |
27 b = strcmp(fullsubpath, paths{i}); | |
28 return | |
29 end | |
30 | |
31 b = false; | |
32 end |