0001 function removeRavenFromPath()
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 addList = matlab.addons.installedAddons;
0013 if any(strcmp(addList.Name,'RAVEN Toolbox'))
0014 error(['RAVEN is installed as MATLAB Add-On. You should uninstall RAVEN via '...
0015 'the Add-On Manager instead. Once uninstalled, you may attempt to run '...
0016 'removeRavenFromPath again to remove any potential remaining RAVEN installations.'])
0017 end
0018
0019
0020 currPath = transpose(strsplit(path(),{';',':'}));
0021 ravenPath = false(numel(currPath),1);
0022 for i=1:numel(currPath)
0023 dirCont = ls(currPath{i});
0024 dirCont = cellstr(dirCont(3:end,:));
0025 if any(contains(dirCont,{'ravenCobraWrapper.m','makeFakeBlastStructure.m','setRavenSolver.m'}))
0026 ravenPath(i)=true;
0027 end
0028 end
0029
0030 ravenPath = unique(regexprep(currPath(ravenPath),'(\\|\/)((external)|(struct_conversion)|(solver))',''));
0031 addOnDir = contains(ravenPath,'MATLAB Add-Ons');
0032 if any(addOnDir)
0033 warning(['RAVEN is installed as MATLAB Add-On at the following directory, but MATLAB '...
0034 'somehow does not recognize this installation. You are advised to manually delete '...
0035 'the directory to remove any RAVEN remnants: ' ravenPath{addOnDir}]);
0036 end
0037 ravenSubDirs = currPath(startsWith(currPath,ravenPath));
0038
0039 if ~isempty(ravenSubDirs)
0040 rmpath(ravenSubDirs{:});
0041 savepath;
0042 end
0043 end