Home > data-utility > genpath_no_svn.m

genpath_no_svn

PURPOSE ^

GENPATH Generate recursive toolbox path.

SYNOPSIS ^

function p = genpath_no_svn(d)

DESCRIPTION ^

GENPATH Generate recursive toolbox path.
   P = GENPATH returns a new path string by adding
   all the subdirectories of MATLABROOT/toolbox, including empty
   subdirectories. 

   P = GENPATH(D) returns a path string starting in D, plus, recursively, all
   the subdirectories of D, including empty subdirectories.
   
   NOTE: GENPATH will not exactly recreate the original MATLAB path.

   See also PATH, ADDPATH, RMPATH, SAVEPATH.

   This version, modified by Thomas Smith, is the same, but leaves out
   directories starting with '.', so it avoids .svn directories for
   instance.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function p = genpath_no_svn(d)
0002 %GENPATH Generate recursive toolbox path.
0003 %   P = GENPATH returns a new path string by adding
0004 %   all the subdirectories of MATLABROOT/toolbox, including empty
0005 %   subdirectories.
0006 %
0007 %   P = GENPATH(D) returns a path string starting in D, plus, recursively, all
0008 %   the subdirectories of D, including empty subdirectories.
0009 %
0010 %   NOTE: GENPATH will not exactly recreate the original MATLAB path.
0011 %
0012 %   See also PATH, ADDPATH, RMPATH, SAVEPATH.
0013 %
0014 %   This version, modified by Thomas Smith, is the same, but leaves out
0015 %   directories starting with '.', so it avoids .svn directories for
0016 %   instance.
0017 
0018 %   Copyright 1984-2006 The MathWorks, Inc.
0019 %   $Revision: 1.13.4.4 $ $Date: 2006/10/14 12:24:02 $
0020 %------------------------------------------------------------------------------
0021 
0022 if nargin==0,
0023   p = genpath_no_svn(fullfile(matlabroot,'toolbox'));
0024   if length(p) > 1, p(end) = []; end % Remove trailing pathsep
0025   return
0026 end
0027 
0028 % initialise variables
0029 methodsep = '@';  % qualifier for overloaded method directories
0030 p = '';           % path to be returned
0031 
0032 % Generate path based on given root directory
0033 files = dir(d);
0034 if isempty(files)
0035   return
0036 end
0037 
0038 % Add d to the path even if it is empty.
0039 p = [p d pathsep];
0040 
0041 % set logical vector for subdirectory entries in d
0042 isdir = logical(cat(1,files.isdir));
0043 %
0044 % Recursively descend through directories which are neither
0045 % private nor "class" directories.
0046 %
0047 dirs = files(isdir); % select only directory entries from the current listing
0048 
0049 
0050 % modified: any dir starting with '.' is left out.
0051 for i=1:length(dirs)
0052    dirname = dirs(i).name;
0053    if    ~strncmp( dirname,'.',1) && ...
0054          ~strncmp( dirname,methodsep,1) && ...
0055          ~strcmp( dirname,'private')
0056       p = [p genpath_no_svn(fullfile(d,dirname))]; % recursive calling of this function.
0057    end
0058 end
0059 
0060 %------------------------------------------------------------------------------
0061 
0062 end

Generated on Wed 24-May-2017 00:00:56 by m2html © 2005