[Gambas-user] getting Gambas version info across devices
Benoît Minisini
g4mba5 at gmail.com
Fri Mar 26 03:22:52 CET 2021
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 <archive path> .startup" to get the
project startup configuration file contents and get the version from it.
This is far more reliable!
Regards,
--
Benoît Minisini
More information about the User
mailing list