-
Notifications
You must be signed in to change notification settings - Fork 0
/
getcurrepos.m
52 lines (44 loc) · 1.38 KB
/
getcurrepos.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
function q=getcurrepos(handles, varargin)
global mypath sl
if exist([mypath sl 'data' sl 'myrepos.mat'])
load([mypath sl 'data' sl 'myrepos.mat'],'myrepos') % backupfolder remotebackup
for r=length(myrepos):-1:1
if exist(myrepos(r).dir,'dir')==0
myrepos(r)=[];
elseif ispc
myrepos(r).dir=strrep(myrepos(r).dir,'/','\'); % in case it somehow gets saved with slashes wrongly, as it did on one of mine
end
end
if isempty(myrepos)
if ~isempty(varargin)
q=[];
return
else
[ST,I] = dbstack;
NewRepos(handles.menuitem_new, [], handles)
load([mypath sl 'data' sl 'myrepos.mat'],'myrepos') % backupfolder remotebackup
end
end
else
if ~isempty(varargin)
q=[];
return
else
NewRepos(handles.menuitem_new, [], handles)
load([mypath sl 'data' sl 'myrepos.mat'],'myrepos') % backupfolder remotebackup
end
end
q=find([myrepos(:).current]==1);
if isempty(q)
if ~isempty(varargin)
q=length(myrepos);
return
end
[~, loadname, val] = archive_gui(0);
elseif length(q)>1
for r=1:length(q)-1
myrepos(q(r)).current=0;
end
q=q(end);
end
save([mypath sl 'data' sl 'myrepos.mat'],'myrepos','-append') % backupfolder remotebackup