On Wednesday, 7 December 2016 at 23:00:13 UTC, Jim Hewes wrote:
On 12/6/2016 10:31 PM, Thomas Mader wrote:
The update case could be better supported by Inno by default
though I
don't know how to really do it transactionally/atomic. Once
everything
is on the drive, how would you be able to switch from the old
directory
to the new one with one atomic action under Windows?
I'm not sure what you mean by switch the directory. If you mean
that the update uses a different directory for the program than
the original, then you can probably just use a "major" upgrade.
Windows Installer has the idea of minor upgrade and major
upgrade. (So, it's independent of whatever tools your using.) A
minor upgrade just updates the files that have changed. A major
upgrade essentially removes the original product totally and
installs the new one. Some people even use a major upgrade for
_every_ new version just to avoid problems that might occur
with a minor upgrade.
The Update is triggered by the application itself. If the install
fails or is Canceled in the middle the application can not start
anymore and so the user needs to do something manually.
It would be possible to update everything into a new directory
and after everything is done just exchange the stuff in the
already installed directory with the new update directory.
But even this operation isn't atomic even though it's much better.
What might work is to make it work like the Nix package manager.
NixOS (Nix Package manager) provides atomic updates because the
entire system environment is build by links. Replacing a version
with another one is just a matter of changing the link to the
proper directory.
So in Windows you could do it the same. Install versions in
separate directories. The installation directory is linking to
the appropriate version directory. On update just install to new
version directory and after everything is done just update the
installation directory link to the new update directory.
No matter what happens either the old or the new application
version should be workable.