[Gambas-user] check 4 Gambas Runtime files?

Karl Reinl karl.reinl at fen-net.de
Wed Dec 13 16:44:08 CET 2017


Am Mittwoch, den 13.12.2017, 08:26 -0700 schrieb mikeB:
> thats what i was thinking (works only if Gambas is installed) but wasn't 
> sure.
> 
> I really would prefer NOT to force the end user to install Gambas but
> only the v10 runtime files that are required to run the Gambas developed
> software/ program. A terminal command to just check if the v10 runtime 
> files are installed is really what I was looking for;-)
> 
> thanks to all that have taken to time to respond -
> it's highly APPRECIATED! Have learned something from every post.
> mikeB
> 
> On 12/13/2017 07:43 AM, PICCORO McKAY Lenz wrote:
> > the suggestin from tobias are the best for check a specific version string,
> > due return a exact result, not an interpretative result
> > 
> > good, but only works if gambas are installed, if not return "commando not
> > found"
> > 
> > 
> > 
> > Lenz McKAY Gerardo (PICCORO)
> > http://qgqlochekone.blogspot.com
> > 
> > 2017-12-13 9:21 GMT-04:00 Jussi Lahtinen <jussi.lahtinen at gmail.com>:
> > 
> >> gbx3 -V
> >> or
> >> gbx3 --version
> >>
> >> Works also...
> >>
> >>
> >> Jussi
> >>
> >> On Wed, Dec 13, 2017 at 9:54 AM, Tobias Boege <taboege at gmail.com> wrote:
> >>
> >>> On Tue, 12 Dec 2017, mikeB wrote:
> >>>> On my web site, that I offer software programmed using Gambas, I have a
> >>>> notice :
> >>>> ***********************************************************************
> >>>> VERY IMPORTANT: before installing this app you will need to install
> >>> Gambas
> >>>> Runtime  v10 files - most systems will not have these very new files
> >>>> installed yet.
> >>>>
> >>>> Do so via the terminal commands:
> >>>> sudo add-apt-repository ppa:gambas-team/gambas3
> >>>> sudo apt-get update
> >>>> ***********************************************************************
> >>>> Now that Gambas runtime 10 files are more common - being install by the
> >>>> Distro - is there a way for the user (terminal command) to check if
> >>> they are
> >>>> installed?
> >>>>
> >>>> This is a real newbie question I'm sure but hey.. I'm a newbie!
> >>>> Thanks for any all help on this matter and have a GREAT day,
> >>>> mikeB
> >>>>
> >>>
> >>> First check if the interpreter gbx3 is found in PATH, using the "which"
> >>> utility. If not, I wouldn't call Gambas properly installed (although
> >>> some people might disagree -- it's their computer -- but then they will
> >>> be able to figure their Gambas version out themselves).
> >>>
> >>> Once you have that, the System class has FullVersion which gives you the
> >>> Gambas version as a string and you can compare it like this:
> >>>
> >>>    $ gbx3 -e 'Comp(System.FullVersion, "3.10", gb.Natural) >= 0'
> >>>
> >>> Comp will return the sign (-1, 0 or 1) of subtracting the version 3.10
> >>> from your Gambas version. You want the comparison to yield 0 or 1.
> >>> With the above line, you will see either the string "True" or "False"
> >>> printed to the terminal; you can make the output fancier.
> >>>
> >>> NOTE: gb.Natural makes the comparison by natural sort, which is
> >>> appropriate
> >>> to compare version numbers. Observe:
> >>>
> >>>    $ gbx3 -e 'Comp("3.2", "3.10")'
> >>>    1
> >>>    $ gbx3 -e 'Comp("3.2", "3.10", gb.Natural)'
> >>>    -1
> >>>
> >>> Because "2" comes before "1" in the alphabet, the default lexicographic
> >>> comparison mode declares the string "3.2" to be greater than "3.10",
> >>> but gb.Natural gets it right.
> >>>
> >>> Also never coerce the string version into a float for easier comparison
> >>> because you'll run into nasty bugs caused by float roundoff.
> >>>
> >>> Regards,
> >>> Tobi
> >>>
> >>> --
> >>> "There's an old saying: Don't change anything... ever!" -- Mr. Monk
> >>>
> >>

Salut mikeB,

reread what Tobi wrote: "which" is the magic command for that.

-- 
Amicalement
Charlie



More information about the User mailing list