[Gambas-user] getting Gambas version info across devices

Bruce Steers bsteers4 at gmail.com
Fri Mar 26 12:26:31 CET 2021


On Fri, 26 Mar 2021 at 05:26, Brian G <brian at westwoodsvcs.com> wrote:

> Funny that
>
> --
> Thanks
> Brian
> Thursday, 25 March 2021, 09:43PM -07:00 from Bruce adamnt42 at gmail.com:
>
> On 26/3/21 12:52 pm, Benoît Minisini wrote:
> > Le 26/03/2021 à 02:49, Brian G a écrit :
> >> Hi BruceS,
> >>
> >> This should work great for most .gambas files like gbs3
> >>
> >> Public Sub GetVersion(FilePath as string)
> >>    Print "Loading file : ";; filePath
> >>    Dim sfile As String = File.Load(FilePath)
> >>    Dim project As Integer = InStr(sfile, "# Gambas Project File
> >> 3.0\n", 1)
> >>    Dim location As Integer = InStr(sfile, "Version=", Project,
> gb.Binary)
> >>    Dim length As Integer = InStr(sFile, "\n", Location, gb.binary) -
> >> location
> >>    Print Mid(sFile, location, length)
> >> end
> >>
> >> This should work for gambas binary files like gbc3 or gba3
> >>    Dim project As Integer = InStr(sfile, "/gambas" & System.version &
> >> "-" & System.Version, 1, gb.Binary)
> >>    Dim length As Integer = InStr(sFile, "/", Project + 1, gb.binary) -
> >> project
> >>    Print Mid(sFile, Project + 1, length - 1)
> >>
> >> output would look like this
> >>
> >> gambas3-3.15.90+git202103222309.dd1a35456+build14e27c76f~ubuntu20.04.1
> >>
> >> "Failure is the key to success;
> >>   each mistake teaches us something"  .. Morihei Ueshiba
> >> Brian G
> >>
> >
> > You should better run "gba3 -x .startup" to get the
> > project startup configuration file contents and get the version from it.
> >
> > This is far more reliable!
> >
> > Regards,
> >
>
> Yes, well, loading a binary file into a string is pretty well going to
> have interesting side effects but in any case the the suggested approach
> for the ELF files doesn't work.
>
> For example, I have searched both gbc3 and gbx3 here and the "tickler"
> gambas3-3 does not occur in those files. I resume it is specific to ubuntu.
>
> b
>
>
Thanks Brian and Benoit.

The trouble is i also want the trunk version info.
seems only the binary files have it, the .gambas files like gbs3 only have
maj.min.rel info
Using your function on gbs3 Brian my output didn't look anything like yours
it looked like this...
*Version=3.15.90*


BruceS
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20210326/51523b19/attachment.htm>


More information about the User mailing list