Adding autoupdate to application
Very often we will want our clients to be able to update automatically, especially if clients are run on large number of computers and / or in different locations.
To make our application automatically update itself, we need to use a simple but efficient pattern for automatic updates. The approach is exactly the same as described in Chapter 3, Tcl Standalone Binaries.
All that is needed is to perform the following steps:
Check if an updated version of the binary is available; if not, then download it
Write the binary as a temporary file with the specified filename
Run the temporary binary
As the temporary binary, overwrite the actual binary and exit
As the temporary binary, run the actual binary, which is now updated and exit
As the actual binary, remove the temporary binary and perform normal actions
In order to be able to tell when we are running a temporary binary, we should always be able to know both file names. As our temporary binary will always be prefixed...