Skip to content

Commit

Permalink
Updates based on WIN64 testing.
Browse files Browse the repository at this point in the history
  • Loading branch information
guzman-raphael committed Sep 18, 2020
1 parent 64c573b commit acb5069
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 15 deletions.
13 changes: 8 additions & 5 deletions +ghtb/install.m
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,18 @@ function install(target, varargin)
end
% add mex-based path if applicable
if verLessThan('matlab', '9.2')
toolboxRoot = [s.matlab.addons.InstallationFolder.ActiveValue '/Toolboxes/' ...
toolboxName '/code'];
toolboxRoot = [strrep(s.matlab.addons.InstallationFolder.ActiveValue, '\', '/') ...
'/Toolboxes/' toolboxName '/code'];
else
toolboxRoot = [s.matlab.addons.InstallationFolder.ActiveValue '/Toolboxes/' ...
toolboxName];
toolboxRoot = [strrep(s.matlab.addons.InstallationFolder.ActiveValue, '\', '/') ...
'/Toolboxes/' toolboxName];
end
if any(arrayfun(@(x) contains(x.name, mexext), dir(toolboxRoot), 'uni', true))
addpath([toolboxRoot '/' mexext]);
savepath;
pathfile = fullfile(userpath, 'startup.m');
fid = fopen(pathfile, 'a+');
fprintf(fid, '\n%s\n',['addpath(''' [toolboxRoot '/' mexext] ''');']);
fclose(fid);
end
end
function conflictCheck(toolboxName, override)
Expand Down
33 changes: 24 additions & 9 deletions +ghtb/uninstall.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,35 @@ function uninstall(varargin)
addRequired(p, 'toolboxName');
parse(p, varargin{:});
toolboxName = p.Results.toolboxName;
% remove all versions of toolbox
toolboxes = matlab.addons.toolbox.installedToolboxes;
matched = toolboxes(strcmp(toolboxName, {toolboxes.Name}));
arrayfun(@(x) matlab.addons.toolbox.uninstallToolbox(x), matched, 'UniformOutput', false);
% remove mex-based path if applicable
if verLessThan('matlab', '9.2')
toolboxRoot = [s.matlab.addons.InstallationFolder.ActiveValue '/Toolboxes/' ...
toolboxName '/code'];
toolboxRoot = [strrep(s.matlab.addons.InstallationFolder.ActiveValue, '\', '/') ...
'/Toolboxes/' toolboxName '/code'];
else
toolboxRoot = [s.matlab.addons.InstallationFolder.ActiveValue '/Toolboxes/' ...
toolboxName];
toolboxRoot = [strrep(s.matlab.addons.InstallationFolder.ActiveValue, '\', '/') ...
'/Toolboxes/' toolboxName];
end
if any(arrayfun(@(x) contains(x.name, mexext), dir(toolboxRoot), 'uni', true))
rmpath([toolboxRoot '/' mexext]);
savepath;
pathfile = fullfile(userpath, 'startup.m');
if exist(pathfile, 'file') == 2
fid = fopen(pathfile, 'r');
f = fread(fid, '*char')';
fclose(fid);
f = regexprep(f,strrep(['\naddpath(''' [toolboxRoot '/' mexext] ''');\n'], ...
')', '\)'), '');
fid = fopen(pathfile, 'w');
fprintf(fid,'%s',f);
fclose(fid);
end
end
% remove all versions of toolbox
toolboxes = matlab.addons.toolbox.installedToolboxes;
matched = toolboxes(strcmp(toolboxName, {toolboxes.Name}));
warning('off','toolboxmanagement_matlab_api:uninstallToolbox:manualCleanupNeeded');
arrayfun(@(x) matlab.addons.toolbox.uninstallToolbox(x), matched, 'UniformOutput', false);
warning('on','toolboxmanagement_matlab_api:uninstallToolbox:manualCleanupNeeded');
if exist(toolboxRoot, 'dir')
rmdir(toolboxRoot);
end
end
2 changes: 1 addition & 1 deletion +ghtb/version.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
% v = ghtb.version % return GHToolbox version
% License:
% MIT (use/copy/change/redistribute on own risk)
v = '1.0.3';
v = '1.0.4';
if nargout
varargout{1}=v;
else
Expand Down
Binary file modified GHToolbox.mltbx
Binary file not shown.

0 comments on commit acb5069

Please sign in to comment.