[Gambas-user] Application.Version of another program
T Lee Davidson
t.lee.davidson at gmail.com
Tue Dec 14 01:39:15 CET 2021
On 12/11/21 12:05 AM, Admin wrote:
> 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.
I didn't see that Benoît responded, so I am.
It is incorrect to say that this example works with the project's sources. The gba3 utility can extract a specific file from a
Gambas executable (ie. a standalone .gambas file). It is what you want.
--
Lee
More information about the User
mailing list