forked from aodn/imos-toolbox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathimosToolbox.m
75 lines (66 loc) · 2.65 KB
/
imosToolbox.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
function imosToolbox(auto, varargin)
%IMOSTOOLBOX Starts the IMOS toolbox.
%
% This function is the entry point for the IMOS toolbox.
%
% Inputs:
% auto - optional String parameter - if 'version', the version of the
% toolbox is output. if 'auto', the toolbox is executed
% automatically, with no user interaction. Any other string will
% result in the toolbox being executed normally.
% varargin - In 'auto' mode, any other parameters passed in are passed
% through to the autoIMOSToolbox function - see the
% documentation for that function for details.
%
% Author: Paul McCarthy <[email protected]>
% Contributor: Gordon Keith <[email protected]>
% -now adds any .jar found in Java directory to the path so that any driver
% can be used to connect to a deployment database for example.
%
%
% Copyright (C) 2017, Australian Ocean Data Network (AODN) and Integrated
% Marine Observing System (IMOS).
%
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation version 3 of the License.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
% You should have received a copy of the GNU General Public License
% along with this program.
% If not, see <https://www.gnu.org/licenses/gpl-3.0.en.html>.
%
% Set current toolbox version
toolboxVersion = ['2.6.4 - ' computer];
if nargin == 0, auto = 'manual'; end
if strcmpi(auto, 'version')
disp(toolboxVersion);
return;
end
path = '';
if ~isdeployed
[path, ~, ~] = fileparts(which('imosToolbox.m'));
% set Matlab path for this session (add all recursive directories to Matlab
% path)
searchPath = textscan(genpath(path), '%s', 'Delimiter', pathsep);
searchPath = searchPath{1};
iPathToRemove = ~cellfun(@isempty, strfind(searchPath, [filesep '.']));
searchPath(iPathToRemove) = [];
searchPath = cellfun(@(x)([x pathsep]), searchPath, 'UniformOutput', false);
searchPath = [searchPath{:}];
addpath(searchPath);
end
if isempty(path), path = pwd; end
% we must dynamically add the ddb.jar java library to the classpath
% as well as any other .jar library and jdbc drivers
jars = fsearchRegexp('.jar$', fullfile(path, 'Java'), 'files');
for j = 1 : length(jars)
javaaddpath(jars{j});
end
switch auto
case 'auto', autoIMOSToolbox(toolboxVersion, varargin{:});
otherwise, flowManager(toolboxVersion);
end