[Gambas-user] Application.Version of another program

Benoît Minisini g4mba5 at gmail.com
Thu Dec 9 23:09:43 CET 2021


Le 09/12/2021 à 17:33, Admin a écrit :
> Don't even remember how many times I bumped into wanting this feature 
> while writing a programm in Gambas, so I decided to ask:
> Is it possible to create such feature, that can easily print another 
> .gambas program version?
> Like
> 
> if Application.Version("~/a.gambas") = "0.0.1" then print "pre-alpha"
> 
> if Application.Version("~/a.gambas") > Application.Version then 
> AutoUpdateSub
> 
> Would be so much less pain to implement autoupdating software. Not that 
> I don't have an established mechanism of doing so, but...
> 
> Best regards,
> Dmitry
> 

At the moment, the only standard way is using the 'gba3' program, which 
may not necessarily be installed.

Sub GetApplicationVersion(sPath As String) As String

   Dim sStartup As String
   Dim aStartup As String[]

   Exec ["gba3", "-x", sPath, ".startup" ] To sStartup
   aStartup = Split(Trim(sStartup), "\n")

   ' Version number is the 5th line of the '.startup' file.
   Return aStartup[4]

End

Regards,

-- 
Benoît Minisini


More information about the User mailing list