Home > installation > removeRavenFromPath.m

removeRavenFromPath

PURPOSE ^

removeRavenFromPath

SYNOPSIS ^

function removeRavenFromPath()

DESCRIPTION ^

 removeRavenFromPath
   This function removes all RAVEN directories and subdirectories from the
   MATLAB path. This function only removes RAVEN from the MATLAB path, it
   does not delete the RAVEN folder itself. If RAVEN was installed as
   MATLAB Add-On, the user is prompted to instead uninstall RAVEN via the
   Add-On Manager.

 Usage: removeRavenFromPath()

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function removeRavenFromPath()
0002 % removeRavenFromPath
0003 %   This function removes all RAVEN directories and subdirectories from the
0004 %   MATLAB path. This function only removes RAVEN from the MATLAB path, it
0005 %   does not delete the RAVEN folder itself. If RAVEN was installed as
0006 %   MATLAB Add-On, the user is prompted to instead uninstall RAVEN via the
0007 %   Add-On Manager.
0008 %
0009 % Usage: removeRavenFromPath()
0010 
0011 % Check for installation as Add-On
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 % Get current paths
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'})) % A few (hopefully) unique RAVEN functions
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 % Remove from path
0039 if ~isempty(ravenSubDirs)
0040     rmpath(ravenSubDirs{:});
0041     savepath;
0042 end
0043 end

Generated by m2html © 2005