Skip to content

Commit

Permalink
a
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaokg committed Jul 2, 2022
1 parent 368e6f6 commit 0e0d12a
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 23 deletions.
10 changes: 8 additions & 2 deletions Matlab/installbeast.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,18 @@

clear Rbeast % just in case that an exisitng version has been loaded

if ~exist('beastPath','var')
warning("The variable 'beastPath' doesnot exist; a temporaby folder is used instead");
if ~exist('beastPath','var')
warning("The variable 'beastPath' does not exist; a temporaby folder is used instead");
beastPath = fullfile(tempdir(), "Rbeast");
disp("BEAST installation Path: " + beastPath);
end

if isempty(beastPath)
beastPath = fullfile(tempdir(), "Rbeast");
disp("BEAST installation Path: " + beastPath);
end


if ~exist(beastPath,"dir")
beast_success=mkdir(beastPath);
if ~ beast_success
Expand Down
2 changes: 1 addition & 1 deletion Matlab/rbeast_path.m
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
end

if isempty(beastpath)
error('Cannot find the BEAST installtion path...');
%warning('Cannot find the BEAST installtion path...');
end
%datapath=bpath1;
%codepath=bpath2;
3 changes: 3 additions & 0 deletions Matlab/rbeast_uninstall.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ function rbeast_uninstall()
oldcodelist={'installbeast.m', 'uninstallbeast.m'};
%%
beastpath = rbeast_path();
if isempty(beastpath)
error('Cannot find the BEAST installtion path...');
end
codepath = beastpath;
datapath = fullfile(beastpath,'testdata');

Expand Down
47 changes: 27 additions & 20 deletions Matlab/rbeast_update.m
Original file line number Diff line number Diff line change
@@ -1,26 +1,33 @@
rbeast_version;
localVersion =rbeastGitHubVersion;
beastPath=rbeast_path();
if ~isempty(beastPath)
rbeast_version;
localVersion =rbeastGitHubVersion;

isDone=0;
try
eval(webread('https://github.com/zhaokg/Rbeast/raw/master/Matlab/rbeast_version.m',weboptions('cert','')))
isDone=1;
end
isDone=0;
try
eval(webread('https://github.com/zhaokg/Rbeast/raw/master/Matlab/rbeast_version.m',weboptions('cert','')))
isDone=1;
end

if (isDone==0)
error("Can't access Github");
end
if (isDone==0)
error("Can't access Github");
end

remoteVersion =rbeastGitHubVersion;
remoteVersion =rbeastGitHubVersion;

if(remoteVersion>localVersion)
str=sprintf('A new version v%f is available from Github. Press y to install it: \n',remoteVersion);
y = input(str,'s');
if strcmp(y,'y')
beastPath=rbeast_path();
rbeast_uninstall();
eval(webread('http://b.link/beast',weboptions('cert','')));
if(remoteVersion>localVersion)
str=sprintf('A new version v%f is available from Github. Press y to install it: \n',remoteVersion);
y = input(str,'s');
if strcmp(y,'y')
rbeast_uninstall();
eval(webread('http://b.link/beast',weboptions('cert','')));
end
else
fprintf('The latest version is being used and no update is available from GitHub. \n' );
end
else
fprintf('The latest version is being used and no update is available from GitHub. \n' );
end


if isempty(beastPath)
eval(webread('http://b.link/beast',weboptions('cert','')));
end

0 comments on commit 0e0d12a

Please sign in to comment.