Mercurial > repos > public > matlab_path_manager
comparison +mpm/MatlabPathManager.m @ 27:05a8b30ee4a7
Make loaded paths persistent across matlab restarts
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Tue, 18 Sep 2018 13:03:53 +0200 |
parents | e2c18217aee0 |
children | 0842a1b2ac7e |
comparison
equal
deleted
inserted
replaced
26:0046610f1573 | 27:05a8b30ee4a7 |
---|---|
24 function loadSubpath(obj, p) | 24 function loadSubpath(obj, p) |
25 state = mpm.PersistentState(obj.stateFilePath); | 25 state = mpm.PersistentState(obj.stateFilePath); |
26 | 26 |
27 addpath(p); | 27 addpath(p); |
28 state.subpaths(p) = true; | 28 state.subpaths(p) = true; |
29 | |
30 state.saveState(); | 29 state.saveState(); |
31 | 30 |
32 % TODO: Add savepath() | 31 savepath() % after save state to make sure saved paths are always present in the state |
33 end | 32 end |
34 | 33 |
35 % Unload a given subpath from the state file and the matlab path and do savepath(), atomically | 34 % Unload a given subpath from the state file and the matlab path and do savepath(), atomically |
36 function unloadSubpath(obj, p) | 35 function unloadSubpath(obj, p) |
37 state = mpm.PersistentState(obj.stateFilePath); | 36 state = mpm.PersistentState(obj.stateFilePath); |
38 | 37 |
39 rmpath(p); | 38 rmpath(p); |
39 savepath() % before save state to make sure saved paths are always present in the state | |
40 state.subpaths.remove(p); | 40 state.subpaths.remove(p); |
41 | |
42 state.saveState(); | 41 state.saveState(); |
43 | |
44 % TODO: Add savepath() | |
45 end | 42 end |
46 | 43 |
47 % Read project file in a folder and return cell array of all subpaths | 44 % Read project file in a folder and return cell array of all subpaths |
48 function sp = projectSubpaths(obj, projectFolder) | 45 function sp = projectSubpaths(obj, projectFolder) |
49 try | 46 try |
135 end | 132 end |
136 end | 133 end |
137 | 134 |
138 % TODO: Organize order of methods | 135 % TODO: Organize order of methods |
139 % TODO: Add flag for being persistent or not? (savepath or not) | 136 % TODO: Add flag for being persistent or not? (savepath or not) |
137 % TODO: Make is at top a method? |