forked from MarineBioAcousticsRC/Triton
-
Notifications
You must be signed in to change notification settings - Fork 0
/
check_path.m
81 lines (71 loc) · 2.46 KB
/
check_path.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
function check_path
% gets Triton path in MATLAB mode and deployed (compiled) mode
% only in MATLAB mode, are paths to various subfolders checked, if not
% present make the subfolders.
% subfolders check here are Remoras and Settings
% other subfolders not used here are Extras, ExampleRemoras
% java subfolder was for old logger and will be removed
%
% Above not executed for deployed (compiled) Triton
%
%
%if settings and java folder are in the search path for Matlab. If
% it is not in there, it is added in
% should also clear remoras to be added when installedRemoras.txt is read
% in...remove this comment when done
global PARAMS
% root directory
if ~isdeployed % standard in MATLAB mode
PARAMS.path.Triton = fileparts(which('triton'));
else
PARAMS.path.Triton = pwd; % for compiled (deployed) version
end
% Settings folder
PARAMS.path.Settings = fullfile(PARAMS.path.Triton,'Settings');
if ~exist(PARAMS.path.Settings, 'dir')
disp(' ')
disp('Settings directory is missing, creating it ...')
mkdir(PARAMS.path.Settings);
if ~isdeployed % standard in MATLAB mode
addpath(PARAMS.path.Settings)
end
end
% Extras folder
PARAMS.path.Extras = fullfile(PARAMS.path.Triton,'Extras');
if ~exist(PARAMS.path.Extras, 'dir')
disp(' ')
disp('Extras directory is missing, creating it ...')
mkdir(PARAMS.path.Extras);
if ~isdeployed % standard in MATLAB mode
addpath(PARAMS.path.Extras)
end
end
% Remoras folder
if ~isdeployed % standard in MATLAB mode
PARAMS.path.Remoras = fullfile(PARAMS.path.Triton, 'Remoras');
RemoraConfFile = fullfile(PARAMS.path.Settings,'InstalledRemoras.cnf');
%remove all Remoras before adding them in again later down in this code
rem_dir = rmpath(genpath(PARAMS.path.Remoras));
% check that remora dir and cnf file haven't been deleted
if exist(PARAMS.path.Remoras) ~= 7
% remoraHome = TritonRemoraDir;
disp(' ')
disp('Remoras directory is missing, creating it ...')
mkdir(PARAMS.path.Remoras);
end
if exist(RemoraConfFile) == 0
% if InstalledRemoras.cnf file doesn't exist, make it
disp(' ')
disp('Remora .cnf file missing, creating it ...');
fid = fopen(RemoraConfFile, 'w+');
fclose(fid);
end
fid = fopen(RemoraConfFile);
remorapath = fgetl(fid);
while ischar(remorapath)
addpath(genpath(remorapath));
remorapath = fgetl(fid);
end
fclose(fid);
end
end