Closed mespotine closed 5 years ago
You can do feature detection to directly test whether the function(s) you require exists.
if not reaper.RequiredSWSFunction then
reaper.MB("This script requires SWS v1.2.3.4.", 'Title', 0)
return
end
This wouldn't be sufficient, as the functions evolve for new functionality. Like Pull Request #960 "BR_MouseContext" which does not support automation items in the current released version of SWS, but will in the future. Just checking for the existence of the function doesn't tell me, whether it already supports automation items. With the version-number, I could determine it 100%-percently.
Perfect, thank you @cfillion :)
As SWS is slowly progressing, some beta-builds are out there with a different subset of functions/actions for bugtesting. But one of the problems is, that it is really difficult to differentiate between these different builds(usually reflecting either the current Master or a PR-build).
The following thread describes the problem quite good: https://forum.cockos.com/showthread.php?t=210391
Therefore I propose the following addition to GetSWSVersion: string SWS_version, string betabuild_version = reaper.GetSWSVersion()
This string must be set by developers, who put out beta-releases according to something like: "Developername: PR or Issue-name with issuenumber - releasenumber and date"
That way, it would be easier to detect, whether I use an unofficial beta-build for bugtesting. In addition to that: If there would be one build by noFish and one by Julian Sader, I could easily see, whether I had the right one installed AND if it's the latest build to give comments on bugs and issues regarding functions.
This could be very helpful when helping you finding bugs early on.
What do you think?
There's also the possibility of (automatically) using the latest git branch/commit sha1 or a unique, ever incrementing build number. This would work well with continuous integration (as @swstim proposed...). But in my opinion not so much with manual dev builds: maintaining a betabuild_version is an extra burden and can very easily be forgotten.
I would love to have a simple function, that returns the currently installed SWS-version. That way, I could include in my scripts a small check, if the right SWS-version is installed and if not, display an error-message.
Especially with scripts, that shall be used by other people as well, this would be a great benefit and much better than an error-message displayed that functionxyz() wasn't found...
The returned values should be compareable, so I could do something like