diff +mpm/verify.m @ 21:02c290e2018c

Refactor ui functions to use the MPM class. Not tested
author Jonatan Werpers <jonatan@werpers.com>
date Mon, 17 Sep 2018 15:49:39 +0200
parents 309cc6c0cd75
children 647cd9e354bf
line wrap: on
line diff
--- a/+mpm/verify.m	Mon Sep 17 15:46:16 2018 +0200
+++ b/+mpm/verify.m	Mon Sep 17 15:49:39 2018 +0200
@@ -3,30 +3,13 @@
 % The right version is at the top of the path
 %
 % Useful to put at the top of some scripts
-function check()
+function verify(d)
     if ~exist('d', 'var') || isempty(d)
-        d = '';
+        d = pwd;
     end
 
-    folders = split(path(), pathsep);
-
-    sp = mpm.subpaths(d);
-    for i = 1:length(sp)
-        if ~isAtTop(sp{i}, fullfile(pwd, sp{i}), folders)
-            error('Subpaths are not correctly set. Try running mpm.set()');
-        end
+    m = mpm.MatlabPathManager();
+    if ~m.verify(d)
+        error('Subpaths are not correctly loaded. Try running mpm.checkin()');
     end
 end
-
-function b = isAtTop(subpath, fullsubpath, paths)
-    for i = 1:length(paths)
-        if ~endsWith(paths{i}, subpath)
-            continue
-        end
-
-        b = strcmp(fullsubpath, paths{i});
-        return
-    end
-
-    b = false;
-end