Skip to content

Commit 024fad8

Browse files
Merge pull request #210 from gibbonCode/cleanup-previous-installs
fix: cleanup old paths during install
2 parents 0c08839 + 06946c9 commit 024fad8

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

installGibbon.m

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,24 @@ function installGibbon(interactive, FEBioPath, profileNameVCW)
4040
mkdir(tempPath)
4141
end
4242

43+
%% Cleanup previous installs
44+
45+
% Make sure we restore the warning settings
46+
ws = warning();
47+
restoreWarnings = onCleanup(@() warning(ws));
48+
49+
if contains(path, gibbonSettings.gibbonPath)
50+
updateStatus('Removing existing gibbon paths...');
51+
warning('off','MATLAB:rmpath:DirNotFound')
52+
rmpath(genpath(gibbonPath))
53+
54+
if contains(path, fullfile('gibbon','lib'))
55+
warning(['A previous installation of GIBBON might still be present on the MATLAB path. '
56+
'Please check your MATLAB path and remove any outdated GIBBON paths.']);
57+
end
58+
addpath(fullfile(gibbonPath,'lib'));
59+
end
60+
4361
%% Add paths
4462

4563
top_statement = 'Adding gibbon paths. Please wait...';
@@ -50,7 +68,6 @@ function installGibbon(interactive, FEBioPath, profileNameVCW)
5068
addpath(pathNames{:})
5169

5270
% Try to make sure we save the path...
53-
ws = warning();
5471
warning('error','MATLAB:SavePath:PathNotSaved');
5572

5673
try

0 commit comments

Comments
 (0)