comparison m-toolbox/classes/+utils/@helper/remove_svn_from_matlabpath.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:f0afece42f48
1 % newpath = remove_svn_from_matlabpath(oldpath)
2 %
3 % An utility function to remove .svn folders from the given path
4 % If no output is provided, it will use and set the current Matlab path
5 %
6 % D Nicolodi 25/03/2011
7 %
8 % VERSION: $Id: remove_svn_from_matlabpath.m,v 1.2 2011/03/25 15:11:40 mauro Exp $
9 %
10
11 function newpath = remove_svn_from_matlabpath(oldpath)
12
13 % if no path given load current matlab path
14 if nargin < 1
15 oldpath = matlabpath();
16 end
17
18 newpath = '';
19 while true
20 % split path definition into components
21 [p, oldpath] = strtok(oldpath,pathsep);
22 if isempty(p)
23 break;
24 end
25 % remove components if it contais .svn
26 if isempty(findstr(p,'.svn'))
27 newpath = [newpath,pathsep,p];
28 end
29 end
30 % remove initial pathsep
31 newpath = newpath(2:end);
32
33 % if no path given set the new path as the current one
34 if nargin < 1
35 path(newpath);
36 end
37
38 end