If I use this to preserve "appinfo.ini" (so I can read the installed version on an upgrade) everything works fine, as long as the file exists. If it's a fresh install, the installer complains that it's corrupt and quits.
Is it a bug or is there some reason I shouldn't be doing this?
the appinfo.ini be updated with a new version number?
"What about Love?" - "Overrated. Biochemically no different than eating large quantities of chocolate." - Al Pacino in The Devils Advocate
Yes it should, and it is, but I thought it would be helpful to be able read it first and then add some custom pre-install code, depending on what version number it returned.
It does work, just not with a fresh install.
if you use custom pre-install code. Guess why it's called pre-install code
Look at the custom installer code of Notepad++ Portable, it's doing what you're looking for.
But the App directory is removed before the installer hits custom code pre-install. In the Notepad++ "installer.ini" the whole app directory is preserved and selected items are removed.
I suppose it's the same thing, just approached from a different (completely opposite) direction. I thought it would be easier to just preserve one file. Thanks for the pointer though.
Guess it should be called "custom code pre install post delete"
:-)
Anyway, the point wasn't that it didn't work, it was that it crashed the installer if it was a fresh install.
but i call that [Bug] and not "custom code pre install post delete". Pre-Install code should be really "pre" and not "between"
Edit:
If you preserve just one file (appinfo.ini), it'll be moved to "`$INSTDIR\~PRESERVEFILE1`" before executing custom pre-install code. Thus the installer (pre-install custom code) won't find "$INSTDIR\App\AppInfo\appinfo.ini" and will fail.
I was using offsets instead of labels. Using labels gives much more predictable results. Obviously. Sorry about that...
There should be a manual for this stuff really.
and debugging is much more fun than reading a manual