-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstartStageServer.m
More file actions
47 lines (41 loc) · 1.44 KB
/
startStageServer.m
File metadata and controls
47 lines (41 loc) · 1.44 KB
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
function startStageServer()
% Add Symphony to path
appinfo = matlab.apputil.getInstalledAppInfo();
for i = 1:numel(appinfo)
if strncmp(appinfo(i).id, 'Symphony', numel('Symphony'))
addpath(genpath(appinfo(i).location));
break;
end
end
% Add Symphony search path to MATLAB path
searchPath = symphonyui.app.Options.getDefault().searchPath;
paths = strsplit(searchPath, ';');
for i = 1:numel(paths)
path = paths{i};
% Find out if the path is in a git repo
[rc, out] = system(['git -C "' path '" rev-parse']);
if ~isempty(out) && isempty(strfind(out, 'Not a git repository'))
warning(out);
end
% If the path is in a git repo
if ~rc
% Get the top-level path of the repo
[rc, out] = system(['git -C "' path '" rev-parse --show-toplevel']);
if rc
warning(['Failed to get top-level git directory: ' out]);
end
path = strrep(out, sprintf('\n'), '');
end
addpath(genpath(path));
end
% Find Stage Server app
appinfo = matlab.apputil.getInstalledAppInfo();
for i = 1:numel(appinfo)
if strncmp(appinfo(i).id, 'StageServer', numel('StageServer'))
stageinfo = appinfo(i);
break;
end
end
% Start Stage Server app
matlab.apputil.run(stageinfo.id);
end