Mercurial > repos > public > matlab_path_manager
comparison +mpm/MatlabPathManager.m @ 30:d9f899b1dfd0
Add status command and make subpathIsActive a static method
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Tue, 18 Sep 2018 14:15:23 +0200 |
parents | 91724783a931 |
children | cbeef8175d59 |
comparison
equal
deleted
inserted
replaced
29:91724783a931 | 30:d9f899b1dfd0 |
---|---|
88 function b = verify(obj, projectFolder) | 88 function b = verify(obj, projectFolder) |
89 mpath = obj.matlabPath(); | 89 mpath = obj.matlabPath(); |
90 sp = obj.projectSubpaths(projectFolder); | 90 sp = obj.projectSubpaths(projectFolder); |
91 | 91 |
92 for i = 1:length(sp) | 92 for i = 1:length(sp) |
93 if ~subpathIsActive(fullfile(projectFolder,sp{i}), mpath) | 93 if ~obj.subpathIsActive(fullfile(projectFolder,sp{i}), mpath) |
94 b = false; | 94 b = false; |
95 return; | 95 return; |
96 end | 96 end |
97 end | 97 end |
98 b = true; | 98 b = true; |
105 for i = 1:length(sp) | 105 for i = 1:length(sp) |
106 obj.unloadSubpath(sp{i}); | 106 obj.unloadSubpath(sp{i}); |
107 end | 107 end |
108 end | 108 end |
109 end | 109 end |
110 end | |
111 | 110 |
112 % Test if the path p is active among folders in path with the same final foldername | 111 methods (Static) |
113 function b = subpathIsActive(p, paths) | 112 % Test if the path p is active among folders in path with the same final foldername |
114 pathparts = split(p, filesep); | 113 function b = subpathIsActive(p, paths) |
115 foldername = pathparts{end}; | 114 pathparts = split(p, filesep); |
115 foldername = pathparts{end}; | |
116 | 116 |
117 for i = 1:length(paths) | 117 for i = 1:length(paths) |
118 if ~endsWith(paths{i}, foldername) | 118 if ~endsWith(paths{i}, foldername) |
119 % Ignore files with different end foldername | 119 % Ignore files with different end foldername |
120 continue | 120 continue |
121 end | |
122 | |
123 b = strcmp(p, paths{i}); | |
124 return | |
125 end | |
126 | |
127 b = false; | |
121 end | 128 end |
122 | |
123 b = strcmp(p, paths{i}); | |
124 return | |
125 end | 129 end |
126 | |
127 b = false; | |
128 end | 130 end |
129 | 131 |
130 % TODO: Organize order of methods | 132 % TODO: Organize order of methods |
131 % TODO: Add flag for being persistent or not? (savepath or not) | 133 % TODO: Add flag for being persistent or not? (savepath or not) |