MatrixBerryCore
OwnPathUtils.m
Go to the documentation of this file.
1 classdef OwnPathUtils
2  properties (Constant,Access=private)
3  EXCLUDE_REGEX_PATTERN='TTD|\.git'
4  EXCLUDE_DEP='externals';
5  end
6  methods (Static)
7  function [dirList,excludePattern]=getOwnAndDepCodeDirList()
8  parentDir=mxberry.io.PathUtils.rmLastPathParts(...
9  fileparts(which('s_install')),1);
10  %
11  dirList={[parentDir,filesep,'products']};
12  excludePattern=...
14  end
15  function [dirList,excludePattern]=getOwnCodeDirList()
16  [dirList,excludePattern]=...
18  excludePattern=[excludePattern,'|',...
20  end
21  %
22  function fileList=getFileListByExtensionList(extList)
24  import mxberry.io.listfilesrecursive;
25  extPattern=strcat('\.',...
26  mxberry.core.string.catwithsep(extList,'|'));
27  %
28  [dirList,patternToExclude]=...
30  %
31  regexStr=['regex:^(?:(?!(',patternToExclude,')).)*',...
32  extPattern,'$'];
33  %
34  fileList=getFieldListByDirListAndRegex(dirList,regexStr);
35  end
36  function fileList=getFieldListByExtAndPkgList(pkgNameList,extList)
38  extPattern=strcat('\.',...
39  mxberry.core.string.catwithsep(extList,'|'));
40  %
41  fPkg2Pattern=@(x)mxberry.core.string.catwithsep(...
42  strcat('\+',strsplit(x,'.')),['\',filesep]);
43  pkgPattern=mxberry.core.string.catwithsep(...
44  cellfun(fPkg2Pattern,pkgNameList,...
45  'UniformOutput',false),'|');
46  %
47  [dirList,patternToExclude]=...
49  %
50  regexStr=['regex:^(?!.*(',patternToExclude,')).*(',...
51  pkgPattern,').*',extPattern,'$'];
52  fileList=getFieldListByDirListAndRegex(dirList,regexStr);
53  end
54  end
55 end
56 %
57 function fileList=getFieldListByDirListAndRegex(dirList,regexStr)
58 import mxberry.io.listfilesrecursive;
59 fileListOfList=cellfun(...
60  @(x)listfilesrecursive(x,regexStr,Inf),...
61  dirList,'UniformOutput',false);
62 fileList=vertcat(fileListOfList{:});
63 end
static function getOwnAndDepCodeDirList()
function filesep()
Constant Property EXCLUDE_REGEX_PATTERN
Definition: OwnPathUtils.m:11
Constant Property EXCLUDE_DEP
Definition: OwnPathUtils.m:13
function listfilesrecursive(in dirName, in patternStr, in maxDepth)
LISTFILESRECURSIVE returns a list of files with names matching a specified pattern in all the subdire...
static function getOwnCodeDirList()