Skip to content

Commit 7b73c28

Browse files
committed
Clear classes on startup if the paths have changed
1 parent 50793af commit 7b73c28

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

PTKAddPaths.m

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ function PTKAddPaths(varargin)
1818
[path_root, ~, ~] = fileparts(full_path);
1919
cached_pathname = [path_root '.' PTKAddPaths_Version_Number];
2020

21+
% We force a class reset if the paths have changed since the last run
22+
clear_classes = ~isempty(PTK_PathsHaveBeenSet) && ~strcmp(PTK_PathsHaveBeenSet, cached_pathname);
23+
2124
if force || (isempty(PTK_PathsHaveBeenSet) || ~strcmp(PTK_PathsHaveBeenSet, cached_pathname))
2225

2326
path_folders = {};
@@ -136,6 +139,11 @@ function PTKAddPaths(varargin)
136139
end
137140
end
138141
end
142+
143+
if clear_classes
144+
close all
145+
clear all classes
146+
end
139147
end
140148

141149
function AddToPath(path_root, path_folders)

0 commit comments

Comments
 (0)