Way to cache stacks from web and update when changes?

Chipp Walters chipp at chipp.com
Wed Aug 20 14:05:00 EDT 2003


-->I'm trying to figure out a way to write an app that automatically updates
itself from the web when it determines that a stack on the web-site changes.
Has anyone done this before?

I pretty much develop all my projects to be self-updating. After a
considerable amount of evolution, this is the process I've finally settled
on:

I first create a startup "splash screen" stack. This stack is minimal and
ONLY has the following functions:

1) Builds and checks the correct folder paths (like one for Plugins,
Tempfiles, etc..). I typically use:

put specialFolderPath(35) into tPath

On Windows, this sets tPath to:
C:\Documents and Settings\All Users\Application Data
which is accessible to all users regardless of permissions. Sometimes, a
user cannot install an executable in the C:/ProgramFiles folder. Also, this
assures all *other* RR files downloaded by my app end up in the *same*
place. I will of course append tPath with "/myCompany/appName" before
installing any files.

2) Checks and verifies internet connection
3) Then checks against a server page (or can be a text file on a server) the
latest version of itself. If it finds there is a newer version, it asks if
the user wishes to update. If "Yes", it issues a:

revGoURL "http://wwww.mydomain.com/myNewSplashScreenInstall.exe"

and quits itself. This will launch a web browser, go to a web page and begin
downloading the new version of the executable. The reason I use a web page
in this instance (instead of having RR do it) is because I want to be
absolutely positive I can download the correct executable and have it
installed over the recent version. Plus, it's a lot simpler. The idea, is
that the Spash Screen stack should be very simple AND reliable. It should
not change much, so this rare event shouldn't be too much problem. All the
other downloads are 'live' and done by RunRev.

4) If the Splash Screen is the latest version, then it checks to see if the
"Main Stack" is already downloaded. It checks the folder the "Main Stack" is
supposed to be in, if it's not there, then it proceeds to automatically
download it 'Live':

put URL "http://www.mydomain.com/mainstack.rev" into URL (binfile: & the
defaultFolder)

where the defaultFolder has already been set up to point to the correct
folder.

5) If the Main Stack already exists:

if exists(stack "Main.rev") then..

then check the version number of it (could be a field or custom prop)
against a version list previously downloaded. If there is a newer version,
prompt the user and then if 'OK', download it.

delete stack "Main.rev" --removes from memory
put URL "http://www.mydomain.com/mainstack.rev" into URL (binfile: & the
defaultFolder)

6.) Once the current version of the Main stack is downloaded, launch it. It
may also have plugins and can manage the plugin downloads itself. I prefer
the Main stack managing all other downloads because it is important to keep
the 'Splash Screen' as simple as possible, so as not to change it very
often. The Main stack can be changed and updated much easier.

I hope this helps...

-Chipp





More information about the use-livecode mailing list