forked from BUNPC/Homer3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
getpaths.m
89 lines (70 loc) · 2.43 KB
/
getpaths.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
function [paths, wspaths, paths_excl_str] = getpaths(options)
DEBUG = 0;
paths = {...
'/'; ...
'/DataTree'; ...
'/DataTree/AcquiredData'; ...
'/DataTree/AcquiredData/Nirs'; ...
'/DataTree/AcquiredData/Snirf'; ...
'/DataTree/AcquiredData/Snirf/Examples'; ...
'/DataTree/AcquiredData/DataFiles'; ...
'/DataTree/AcquiredData/DataFiles/Hdf5'; ...
'/DataTree/ProcStream'; ...
'/FuncRegistry'; ...
'/FuncRegistry/UserFunctions'; ...
'/FuncRegistry/UserFunctions/Archive'; ...
'/FuncRegistry/UserFunctions/tcca_glm'; ...
'/MainGUI'; ...
'/Install'; ...
'/PlotProbeGUI'; ...
'/ProcStreamEditGUI'; ...
'/PvaluesDisplayGUI'; ...
'/StimEditGUI'; ...
'/UnitTests'; ...
'/UnitTests/Example9_SessRuns'; ...
'/Utils'; ...
'/NirsplotGUI';...
};
wspaths = {};
paths_excl_str = {};
if options.conflcheck
% Get all workspace paths that have similar functions sets with current applications
appmainfunc = {'Homer2_UI.m','Homer3.m','brainScape.m'};
kk=1;
wsidx = [];
for ii=1:length(appmainfunc)
while 1
[paths_excl, foo] = getactivewspace(appmainfunc{ii});
if isempty(paths_excl)
break;
end
wspaths{kk,1} = foo;
if pathscompare(wspaths{kk}, pwd)
wsidx = kk;
end
paths_excl_str{kk} = '';
for jj=1:length(paths_excl)
if DEBUG
fprintf('Removing path %s\n', paths_excl{jj});
end
if isempty(paths_excl_str{kk})
paths_excl_str{kk} = paths_excl{jj};
else
paths_excl_str{kk} = [paths_excl_str{kk}, delimiter, paths_excl{jj}];
end
end
rmpath(paths_excl_str{kk});
kk=kk+1;
end
end
% Change the order of precedence of all the conflicting workspaces to
% the current one as primary workspace
if ~isempty(wsidx)
strtmp = wspaths{1};
celltmp = paths_excl_str{1};
wspaths{1} = wspaths{wsidx};
paths_excl_str{1} = paths_excl_str{wsidx};
wspaths{wsidx} = strtmp;
paths_excl_str{wsidx} = celltmp;
end
end