[Gambas-user] Application.Version of another program

Admin admin at allunix.ru
Sat Dec 11 06:05:01 CET 2021


10.12.2021 5:09, Benoît Minisini пишет:
> 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,
>
Benoit, correct me if I am wrong, but this example works with the 
project's sources, so if I am distributing my program as a standalone 
.gambas file, gba3 is of no use.



More information about the User mailing list