diff --git a/Matlab/installbeast.m b/Matlab/installbeast.m index 48265db..05afee8 100644 --- a/Matlab/installbeast.m +++ b/Matlab/installbeast.m @@ -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 diff --git a/Matlab/rbeast_path.m b/Matlab/rbeast_path.m index fd90bfa..409809f 100644 --- a/Matlab/rbeast_path.m +++ b/Matlab/rbeast_path.m @@ -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; \ No newline at end of file diff --git a/Matlab/rbeast_uninstall.m b/Matlab/rbeast_uninstall.m index 997c9e8..b8073e2 100644 --- a/Matlab/rbeast_uninstall.m +++ b/Matlab/rbeast_uninstall.m @@ -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'); diff --git a/Matlab/rbeast_update.m b/Matlab/rbeast_update.m index efe70bc..84c6636 100644 --- a/Matlab/rbeast_update.m +++ b/Matlab/rbeast_update.m @@ -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 \ No newline at end of file