[Gambas-user] getting Gambas version info across devices

Brian G brian at westwoodsvcs.com
Fri Mar 26 06:15:07 CET 2021


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
>
>----[  http://gambaswiki.org/wiki/doc/netiquette ]----
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20210326/366899fa/attachment.htm>


More information about the User mailing list