Check standalone version?

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
thatkeith
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 346
Joined: Mon Mar 01, 2010 7:13 pm
Location: London, UK
Contact:

Check standalone version?

Post by thatkeith » Thu Nov 30, 2017 7:16 pm

When I build a stand-alone I set the app version. Is there a way to check the version of a standalone (my app’s own version, not the version of the underlying engine) by script?
I’d like my app to make a simple check for a newer version of itself (by checking for a bit of data in an online file) so it can prompt the user to go get the latest build. Nothing fancy, no auto-update, just ‘is the app version of me a lower numeric value than x’

Any thoughts?

K
Technical Writer, Meta
University Lecturer
Technical Editor, MacUser (1996-2015)
360 VR media specialist

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Check standalone version?

Post by Klaus » Thu Nov 30, 2017 7:32 pm

Hi Keith,

since stacks do not have a version number or something, you will need to roll your own!
Simply create a custom property of your stack and put your version number into it.

Set CP:
...
set the cVersion of stack "your stack here..." to "1.00"
...
Get CP:
...
put the cVersion of stack "your stack here..." into tCurrentVersion
...
Then you can compare this one with your little "online file".


Best

Klaus

thatkeith
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 346
Joined: Mon Mar 01, 2010 7:13 pm
Location: London, UK
Contact:

Re: Check standalone version?

Post by thatkeith » Thu Nov 30, 2017 7:44 pm

Heh. Good workaround! Also easy to use while in stack development mode. But is there no way for a *standalone* to find out its own version number? Given that it’s something stored internally in a plist (in a Mac app at least), it seems quite inelegant to have to roll my own. :-/
Technical Writer, Meta
University Lecturer
Technical Editor, MacUser (1996-2015)
360 VR media specialist

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Check standalone version?

Post by Klaus » Thu Nov 30, 2017 7:49 pm

Hi Keith,

looks like I misunderstood you, you mean the infos you entered in the "Standalone builder settings", right?

They are stored in a custom property set in your stack -> cRevStandaloneSettings
Check what is in there and then you can use e.g.:
...
put the cRevStandaloneSettings["OSX,shortVersion"] of stack "your stack here" into tCurrentVersion
...

Best

Klaus

thatkeith
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 346
Joined: Mon Mar 01, 2010 7:13 pm
Location: London, UK
Contact:

Re: Check standalone version?

Post by thatkeith » Thu Nov 30, 2017 7:56 pm

Fantastic! I’ll check that out, it sounds perfect.
Technical Writer, Meta
University Lecturer
Technical Editor, MacUser (1996-2015)
360 VR media specialist

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9802
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Check standalone version?

Post by FourthWorld » Thu Nov 30, 2017 8:06 pm

Klaus wrote:
Thu Nov 30, 2017 7:49 pm
Hi Keith,

looks like I misunderstood you, you mean the infos you entered in the "Standalone builder settings", right?

They are stored in a custom property set in your stack -> cRevStandaloneSettings
Check what is in there and then you can use e.g.:
...
put the cRevStandaloneSettings["OSX,shortVersion"] of stack "your stack here" into tCurrentVersion
...
Unless something has changed, I believe the IDE's standalone settings are removed from the stack in the resulting build.

I use a custom prop for version info.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Check standalone version?

Post by bogs » Thu Nov 30, 2017 9:07 pm

I think they are talking about these settings, Richard -

Image

Although I wouldn't mind being sure where to find the info you put there myself, as well as having it auto-increment the version for me :twisted: I think for ease on my part I'd also use a cprop for this, and setup a script to auto-increment it, possibly on save.

Of course, I'm usually far too lazy for that, I just wait till release and count up the number of 'built' folders :roll:
Image

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9802
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Check standalone version?

Post by FourthWorld » Fri Dec 01, 2017 12:44 am

bogs wrote:
Thu Nov 30, 2017 9:07 pm
I think they are talking about these settings, Richard -

Image
Yep, those are the ones. The IDE uses them to build standalones. Last time I check those properties are not present in the standalones built.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Check standalone version?

Post by bogs » Fri Dec 01, 2017 4:37 am

FourthWorld wrote:
Fri Dec 01, 2017 12:44 am
Yep, those are the ones. The IDE uses them to build standalones. Last time I check those properties are not present in the standalones built.
Hmm. I dunno, when I look at the standalone made (for mac, as that pictures settings showed), those settings are going into the plist, so the xml should be able to be parsed to retrieve the info you put in in standalone settings.
Image
I wonder if it might actually be storing this info in the standalone somewhere. The win standalone looks like a similar (but monolithic) structure -
Image
I didn't bother trying to sort through that mess :wink:

Whether it does or no, at least for the mac, you could pull that information from the plist file, thatkeith. But if you want consistency thats easy to code, either of Klaus's and Richard's answers, (cprop, anyway) work easier.
Image

thatkeith
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 346
Joined: Mon Mar 01, 2010 7:13 pm
Location: London, UK
Contact:

Re: Check standalone version?

Post by thatkeith » Fri Dec 01, 2017 12:10 pm

Klaus wrote:
Thu Nov 30, 2017 7:49 pm
put the cRevStandaloneSettings["OSX,shortVersion"] of stack "your stack here" into tCurrentVersion
Bingo! Thanks Klaus, that's it. I won't have to remember to keep my own custom record of the standalone version in sync with reality, I can check against the value stored in the standalone automatically.

k
Technical Writer, Meta
University Lecturer
Technical Editor, MacUser (1996-2015)
360 VR media specialist

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7214
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Check standalone version?

Post by jacque » Fri Dec 01, 2017 6:21 pm

@Keith, what Richard said is true. The standalone settings are used to build the standalone (and to create the plist file) but are not included in the standalone itself. The info you want will return empty in the app.

I also use a custom property to store the current version, which does get saved into the standalone. Or you could read the plist file. I have used the standalone settings in a "savingStandalone" handler sometimes to automatically update the version property during a build.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

thatkeith
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 346
Joined: Mon Mar 01, 2010 7:13 pm
Location: London, UK
Contact:

Re: Check standalone version?

Post by thatkeith » Fri Dec 01, 2017 7:31 pm

Ah, thanks everyone. I'm now using a custom prop as advised.
Technical Writer, Meta
University Lecturer
Technical Editor, MacUser (1996-2015)
360 VR media specialist

Zax
Posts: 431
Joined: Mon May 28, 2007 10:12 am
Location: France

Re: Check standalone version?

Post by Zax » Wed May 08, 2019 3:13 pm

I used to use a custom property but, when building an update, I have to modify the standalone settings and the custom property.
I would be easier to retreive version number grom the .plist file, but ~/Library/Preferences/myStandalone.plist, built with Indy 9.03, looks like this:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>NSNavLastRootDirectory</key>
	<string>/Volumes/SSD/SOUK</string>
	<key>NSNavPanelExpandedSizeForOpenMode</key>
	<string>{712, 681}</string>
	<key>NSNavPanelExpandedSizeForSaveMode</key>
	<string>{712, 521}</string>
	<key>NSNavPanelExpandedStateForSaveMode</key>
	<true/>
</dict>
</plist>
There is no version node :(
But when I'm asking infos about myStandalone app from the Finder, its version is correctly displayed.

Maybe I'm looking into a "wrong" plist file? Is there another plist file?

Thank you.

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7214
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Check standalone version?

Post by jacque » Wed May 08, 2019 6:54 pm

The plist you need is inside the app bundle, inside the Contents folder.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Zax
Posts: 431
Joined: Mon May 28, 2007 10:12 am
Location: France

Re: Check standalone version?

Post by Zax » Thu May 09, 2019 8:43 am

OK, thank you Jacqueline.
I think I will continue to manage version in a custom property!

Post Reply

Return to “Talking LiveCode”