-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootstrap.m
More file actions
36 lines (30 loc) · 936 Bytes
/
Copy pathbootstrap.m
File metadata and controls
36 lines (30 loc) · 936 Bytes
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
root = fileparts(mfilename('fullpath'));
% Add src root to path
addpath(root);
% Manage demos folder paths
dmc_demos = fullfile(root, 'utils', 'dmc');
epfc_demos = fullfile(root, 'utils', 'epfc');
% Remove old lib paths if they exist
old_dmc_lib = fullfile(root, 'lib', 'dmc');
old_epfc_lib = fullfile(root, 'lib', 'epfc');
if ismember(old_dmc_lib, strsplit(path, pathsep))
rmpath(old_dmc_lib);
end
if ismember(old_epfc_lib, strsplit(path, pathsep))
rmpath(old_epfc_lib);
end
% Auto-detect caller and add appropriate demos path
stack = dbstack('-completenames');
caller_file = '';
if numel(stack) >= 2
caller_file = stack(2).file;
end
if contains(caller_file, [filesep 'scripts' filesep 'dmc' filesep])
addpath(dmc_demos);
elseif contains(caller_file, [filesep 'scripts' filesep 'epfc' filesep])
addpath(epfc_demos);
else
% Default: add both if called from non-script context
addpath(dmc_demos);
addpath(epfc_demos);
end