changeset 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 0046610f1573
children 0842a1b2ac7e
files +mpm/MatlabPathManager.m
diffstat 1 files changed, 3 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/+mpm/MatlabPathManager.m	Tue Sep 18 12:57:32 2018 +0200
+++ b/+mpm/MatlabPathManager.m	Tue Sep 18 13:03:53 2018 +0200
@@ -26,10 +26,9 @@
 
             addpath(p);
             state.subpaths(p) = true;
-
             state.saveState();
 
-            % TODO: Add savepath()
+            savepath() % after save state to make sure saved paths are always present in the state
         end
 
         % Unload a given subpath from the state file and the matlab path and do savepath(), atomically
@@ -37,11 +36,9 @@
             state = mpm.PersistentState(obj.stateFilePath);
 
             rmpath(p);
+            savepath() % before save state to make sure saved paths are always present in the state
             state.subpaths.remove(p);
-
             state.saveState();
-
-            % TODO: Add savepath()
         end
 
         % Read project file in a folder and return cell array of all subpaths
@@ -137,3 +134,4 @@
 
 % TODO: Organize order of methods
 % TODO: Add flag for being persistent or not? (savepath or not)
+% TODO: Make is at top a method?
\ No newline at end of file