-
Notifications
You must be signed in to change notification settings - Fork 2
/
dsexpandpath.m
executable file
·63 lines (61 loc) · 1.63 KB
/
dsexpandpath.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
function res=dsexpandpath(matchstr)
global ds;
outpath=ds.sys.outdir;
if(nargin<1)
matchstr='*';
end
%mymkdir([outpath '/ds/']);
[matchstr brakidx]=dssplitmatchstr(matchstr);
%if(isfield(ds,'distproc'))
% distproc=ds.distproc;
% ds=rmfield(ds,'distproc');
%end
%if((numel(matchstr)>=3)&&strcmp(matchstr(1:3),'ds.'))
% matchstr=matchstr(4:end)
%end
%if(isfield(ds,'sys'))
% ds2=rmfield(ds,'sys');
% sys=ds.sys;
%else
% sys=struct();
% ds2=ds;
%end
%if(~isfield(sys,'currpath'))
% sys.currpath='';
%end
%[realpath,~,~,savestate]=dsdiskpath(['ds' sys.currpath]);
%if(isempty(savestate))
% savestate=struct();
%end
[matchstr brakidx]=dssplitmatchstr(matchstr);
matchstr=dsabspath(matchstr);
matchstr=matchstr(5:end);
if(isfield(ds,'sys'))
ds2=ds.sys.root;%rmfield(ds,'sys');
sys=ds.sys;
eval(['ds2' sys.currpath '=rmfield(ds,''sys'');']);
else
sys=struct();
sys.savestate=struct();
ds2=ds;
end
if(~isfield(sys,'currpath'))
sys.currpath='';
end
savestate=sys.savestate;
%[realpath,~,~,savestate]=dsdiskpath(['ds' sys.currpath],1);
%if(isempty(savestate))
% return;
%end
%if(~isfield(ds,'savestate'))
[~,~,res]=dsrecurse(ds2,[outpath '/ds'],[outpath '/ds'],savestate,matchstr,{'ds','savestate'},'expandpath',brakidx,struct('name',{},'type',{}),'.ds');
%for(i=1:numel(res))
% res{i}=['.ds.' res{i}];
%end
% else
% [~,~,res]=dsrecurse(rmfield(ds,'savestate'),[outpath '/ds'],[outpath '/ds'],ds.savestate,matchstr,{'ds','savestate'},'expandpath',brakidx);
% end
% if(exist('distproc','var'))
% ds.distproc=distproc;
% end
end