Conditional Statements and Version Numbers
Ken Ray
kray at sonsothunder.com
Mon Apr 23 12:28:42 EDT 2007
On Tue, 24 Apr 2007 02:15:38 +1000, Scott Kane wrote:
> G'day,
>
> In some other programming languages it's possible to use conditional
> defines to conditionally run parts of your code. This is particuarly
> useful when done in combination with version or build numbers. I
> can't seem to find similar methods in Rev. That is to say I can't
> find conditional defines or the ability to get a stand alones version
> or build number (though I can certainly find out the version or build
> of the Rev engine used to built it).
Well, the standalone's version or build number as defined in the
Standalone Builder is stored in a custom property set of your stack
called "cRevStandaloneSettings". So for example, to get the version
number (under Windows), you'd do this:
put the cRevStandaloneSettings["Windows,productversion1"] of this
stack into tDigit1 --major
put the cRevStandaloneSettings["Windows,productversion2"] of this
stack into tDigit2 --minor
put the cRevStandaloneSettings["Windows,productversion3"] of this
stack into tDigit3 --cosmetic
put the cRevStandaloneSettings["Windows,productversion4"] of this
stack into tDigit4 --build
put tDigit1 & "." & tDigit2 & "." & tDigit3 & "." & tDigit4 into
tVersionNumber
So if I wanted to have code that only applied to version 2.0.0.0 or
higher of my app, I could say:
if (the cRevStandaloneSettings["Windows,productversion1"] of this
stack) >= 2 then
-- do my stuff
end if
Or if I've already retrieved the values as outlined above, I could just
say:
if tDigit1 >=2 then
-- do my stuff
end if
HTH,
More information about the use-livecode
mailing list