[wpkg-users] value have underscores?

Rainer Meier r.meier at wpkg.org
Tue May 15 16:16:44 CEST 2012


Hi Semián,

On 15.05.2012 15:41, Semián Matěj wrote:
> It does not work for version checks.. So be avare of this in your scripts.
>
> Log:
>
> File version check for file
> 'H:\WINDOWS\System32\Macromed\Flash\Flash32_11_2_202_235.ocx' returned false for
> operation type versiongreaterorequal.
> Checking file version 11.2.202.235 is versiongreaterorequal (than) 11_2_202_235
> - got result -1.

It was never claimed to work like this. Version 11.2.202.235 is clearly a 
different string than 11_2_202_235 and therefore it's not equal.

I've even tried to point this out in my first reply. Since for WPKG there are 
not version delimiters (".") in the underscored version string it is regarded as 
being "one version component". As a result WPKG compares the first components 
which means it's comparing 11 against "11_2_202_235". Internally WPKG assures 
that both string get equal number of components:

11-0-000-000
11-2-202-235

Which makes WPKG finally believe that 11.2.202.235 is a lower version than 
11_2_202_235.

And before you ask. I thought about accepting underscores as component 
delimiters seamlessly as dots. But finally I came to the conclusion that it's a 
bad idea as some underscores might be used by some software in the same way as 
dashes are used sometimes:

- 1.0
- 1.0-1 (or 1.0_1)
- 1.1-0 (or 1.1_0)
- 1.1-1 (or 1.1_1)
- 1.1-2 (or 1.1_2)

I believe that the current algorithm is very stable and flexible. But comparing 
two completely differently formatted version string is almost impossible to do 
with full automatic detection. So for flash you might either define two 
variables with dotted and underscored versions or just use either of them. But 
do not mix.

If you're checking for file version of a file which has the version already in 
the file name itself, then a simple file exist check should be sufficient as 
it's extremely unlikely that a file named Flash32_11_2_202_235.ocx contains a 
version other than 11.2.202.235.

br,
Rainer



More information about the wpkg-users mailing list