Closed marcomasser closed 9 years ago
This is probably quite uninteresting to most people. But as a developer of LaunchBar, I sometimes have a newer version of it running than it says in the update feed and your action always reported that a newer version was available while actually an older one was available 😉
I wasn't sure the versions were numbers (what is 6.1.2 as a number for example), and if strings then comparing a multipart version number can be tricky as string sort for comparison may not be correct
is 6.1.1 > 6.11
so leaving to string sort/comparison was something I just avoided
do I not need to worry about that?
At least in Safari’s web inspector, "6.1.1" > "6.11"
evaluates to false
, which looks correct to me. So comparing version numbers should work automagically.
it goes wrong when multiple digits involved, like document.write("10.10" > "10.9")
Oh, right. Well, then it’s probably better to simply leave it as it is.
hi I've this problem too, since most of my actions have a newer version than their repo. how about a proper version compare? source: https://gist.github.com/TheDistantSea/8021359 test: http://jsfiddle.net/pCX3V/
Oh, of course the same problem arises for everyone developing actions – I haven’t updated mine since adding support for updates, so I didn’t run into this yet. In that case I definitely think it would be a good idea to include proper version checks for Action updates, as well as for LaunchBar updates.
The challenge is that there is no requirement to have a "normal" versioning number scheme like major.minor.patch. That is why I didn't do this originally. I will try to come up with something that says if it looks like a standard version id then parse and compare it as such, otherwise fall back to simple string != check. Would also be useful if the LB documentation stated that actions should use standard version identifiers
Implemented with c8e341aa1db2d245b51f549b7d32d42b4f07ceae
if in the form of major[.minor][.patch]
then will 0 fill and parse each as integer and numerically compare, otherwise will simply string compare
the function I used if you want to experiment https://jsfiddle.net/prenagha/yjx4x12g/
Nice, thank you. I will add a comment in the documentation about the version format.
A newer LaunchBar version was reported every time the version was not equal to the currently running one.