A poor man's app updater

Graham Samuel livfoss at mac.com
Sun Mar 18 07:44:47 EDT 2018


I’ve written before about trying to include within a desktop app a check for updates, and a user-driven update action: I’ve looked a bit at Trevor’s incorporation of such a scheme in Levure, and independently at Sparkle (only for Macs), but I have never reached an encapsulated solution that works without leaving my LiveCode comfort zone. I just thought people might like to know what I’ve actually done to solve the problem - it’s primitive beyond belief to anyone who is happy to go outside the LCCZ, but it’s all I can do with very limited resources of intellect and time. I’d love to hear of a better solution (there must be one).

The app in question (only desktop right now) is a classic splash screen design, with the splash providing access to a licensing gateway and a script library, and everything else in another mainstack (let’s call it the Working Stack), which is not compiled but rather included as a file in the installed package as a template - a copy is made in a writeable area for working purposes when the program starts up for the first time. The app is installed via a web site, so there is a server we can use for stuff such as installers. This server includes a tiny text file which records the latest version number of the app.

When the app is initialised, it compares a version number built in to the Working Stack with the version number in the file on the server - of course if the program isn’t connected to the internet, this doesn’t take place.

If the comparison shows that there is a more recent version, the user is warned via a dialog and asked whether to ignore for now, ignore this particular update permanently, or to install the update. The “ignore this version” option updates a property in the Working Stack so the same warning isn’t repeated next time.

Now, here is the primitive bit: if the user selects the update option, he/she is invited to carry out the following sequence:

- quit the current version (actually this can of course be done automatically via an “OK” button);

- delete the current version using the facilities of the OS (just trash it from the Applications folder on a Mac, or use the Control Panel on Windows): there is no reliable way of doing this from within an LC standalone, AFAIK;

- download and run a special “Uninstall Helper” program that gets rid of the Working Stack in the writeable area, plus preference files and the like - I don’t see any way of making this happen automatically, since logically it needs to be done **after** the main program is deleted;

- use the information given at the time of purchase to download the appropriate installer from the server;

- reinstall the program and input the registration data from the original purchase.

Clunky ain’t in it, but so far I have not thought of a better solution.


Graham



More information about the use-livecode mailing list