Page 1 of 1

Determining the OpenSim version in use from the MATLAB API

Posted: Fri May 07, 2021 3:46 am
by modenaxe
Hello,
I am trying to update some of my scripts so that they can run on OpenSim 4.x but I like the idea of keeping backward compatibility with OpenSim 3.3, which I still use sometimes. I was wondering if there is any method available from the MATLAB API that returns the OpenSim version being used. Currently I am reading the $OPENSIM_HOME environment variable, but I was looking for a more robust approach.
Thank you,
Luca

Re: Determining the OpenSim version in use from the MATLAB API

Posted: Fri May 07, 2021 12:02 pm
by aymanh
Hi Luca,

While this may help short term, you probably need to upgrade since official OpenSim 4.0 has been out for close to 3 years but anyway, you can use

Code: Select all

opensimCommonJNI.GetVersion()
to get the exact version of the API you're using. I'm sure this has been in all 4.0+ versions but likely it existed in earlier versions as well.

The environment variable OPENSIM_HOME, has been dropped in version 4.0+, is not set by installer since it pollutes the environment and precludes using multiple installations on the same machine and so should not be assumed by new code.

Please let us know if that works for you,
-Ayman

Re: Determining the OpenSim version in use from the MATLAB API

Posted: Tue May 11, 2021 4:36 am
by modenaxe
Thank you Ayman, that works!
Based on my tests the method did not exists for OpenSim 3.3 but that is not an issue.
Best wishes,
Luca