Permalink
Browse files

RF: always set exclude pattern

  • Loading branch information...
1 parent 36128ca commit 0349d6774bb7090ed4942a48041ec913655e8f24 @nno nno committed Jul 27, 2016
Showing with 27 additions and 14 deletions.
  1. +2 −2 MOcov/@MOcovMFileCollection/get_coverage_json.m
  2. +25 −12 MOcov/mocov_find_files.m
@@ -28,7 +28,7 @@
'UniformOutput',false);
source_files_json=strjoin(source_files_json_cell,',');
- misc_data=get_misc_data(params);
+ misc_data=get_misc_data(service);
json=sprintf(['{ \n',...
'"service_job_id": "%s",\n',...
@@ -67,7 +67,7 @@
misc_data_cell=cell(0);
if isfield(params,'parallel')
% attempt to support parallel
- misc_data_cell{end+1}=sprintf(',"parallel": %s\n',...
+ misc_data_cell{end+1}=sprintf('"parallel": %s,\n',...
lower(params.parallel));
end
misc_data=sprintf('%s',misc_data_cell{:});
View
@@ -50,23 +50,35 @@
regexptranslate('wildcard',file_pat) ...
'$']; % end of the string
- exclude_re='';
- for k=1:numel(exclude_pat)
- if ~isempty(exclude_re)
- exclude_re=[exclude_re '|'];
- end
- exclude_re=[exclude_re ...
- '^' ... % start of the string
- regexptranslate('wildcard',exclude_pat{k}) ...
- '$']; % end of the string
- end
+ exclude_re=get_exclude_re(exclude_pat);
if ~isempty(monitor)
msg=sprintf('Finding files matching %s from %s',file_pat,root_dir);
notify(monitor, msg);
end
- res=find_files_recursively(root_dir,file_re,monitor);
+ res=find_files_recursively(root_dir,file_re,monitor,exclude_re);
+
+function re=get_exclude_re(exclude_pat)
+ n=numel(exclude_pat);
+ if n==0
+ re='';
+ return;
+ end
+
+ excl_re_cell=cell(n,1);
+ for k=1:n
+ re_k=['^' ... % start of the string
+ regexptranslate('wildcard',exclude_pat{k}) ...
+ '$']; % end of the string
+ excl_re_cell{k}=re_k;
+ end
+
+ joined=sprintf('|%s',excl_re_cell{:});
+ re=joined(2:end);
+
+
+
function res=find_files_recursively(root_dir,file_re,monitor,exclude_re)
if isempty(root_dir)
@@ -91,7 +103,8 @@
if ~isempty(regexp(fn,exclude_re,'once'));
continue;
elseif isdir(path_fn)
- res=find_files_recursively(path_fn,file_re,monitor,exclude_re);
+ res=find_files_recursively(path_fn,file_re,...
+ monitor,exclude_re);
elseif ~isempty(regexp(fn,file_re,'once'));
res={path_fn};
if ~isempty(monitor)

0 comments on commit 0349d67

Please sign in to comment.