From 075734b1385619e21b989d5daf9b2f47f9fb67ab Mon Sep 17 00:00:00 2001 From: Thomas Lambert <t.lambert@uliege.be> Date: Mon, 12 Feb 2024 09:45:17 +0100 Subject: [PATCH] fix: better test for toolbox The old test was sometimes saying that the toolbox was installed when it was not. I do not know why. This seems more robust. --- src/rotare.m | 2 +- src/utils/istoolboxinstalled.m | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 src/utils/istoolboxinstalled.m diff --git a/src/rotare.m b/src/rotare.m index 0823eb6..3ffb09c 100644 --- a/src/rotare.m +++ b/src/rotare.m @@ -57,7 +57,7 @@ function [Results] = rotare(configFile) addpath(genpath('.')); rmpath(genpath('./airfoil_data/')); addpath('./airfoil_data/'); - if license('test', 'Aerospace_Toolbox') + if istoolboxinstalled('Aerospace Toolbox') rmpath('./libs/octave-atmosisa/'); end diff --git a/src/utils/istoolboxinstalled.m b/src/utils/istoolboxinstalled.m new file mode 100644 index 0000000..3f35d71 --- /dev/null +++ b/src/utils/istoolboxinstalled.m @@ -0,0 +1,31 @@ +function result = istoolboxinstalled(toolbox) + % ISTOOLBOXINSTALLED Check if a toolbox is installed and available + % ----- + % + % Syntax: + % result = isToolboxInstalled(toolbox) returns true if the toolbox is intalled. + % + % Inputs: + % toolbox: Name of a toolbox, as displayed in `ver` command + % + % Outputs: + % result : boolean that indicates if toolbox is installed + % + % See also: ver. + % + % <a href="https://gitlab.uliege.be/rotare/documentation">Complete documentation (online)</a> + + % ---------------------------------------------------------------------------------------------- + % (c) Copyright 2022-2024 University of Liege + % Author: Thomas Lambert <t.lambert@uliege.be> + % ULiege - Aeroelasticity and Experimental Aerodynamics + % MIT License + % Repo: https://gitlab.uliege.be/rotare/rotare + % Docs: https://gitlab.uliege.be/rotare/documentation + % Issues: https://gitlab.uliege.be/rotare/rotare/-/issues + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + v = ver; + result = any(strcmp(toolbox, {v.Name})); + +end -- GitLab