Get File Version at Compile
Does anybody know if it is possible to get the version of a file at compile time? Hopefully storing it in a variable or constant. I would like to do my version compare in the .onInit function, so if the user is trying to install an old version on top of a new version it will stop them asap.
I have no problems getting the version of the file that is actually installed. I am having troubles getting the version of the file that is bundled in the installer. I came up with the idea of setting a variable with the version of the bundled file on compile. That way I can get it set when the installer is built and use it where I need to.
One suggestion that might save you needing an extra script to get this at runtime:
why dont you extract the new file (at runtime) to the temp directory and get the file versions and compare them?
Considering that the installer already extract quite a few files to the plugins dir, one more file for version checking wouldn't add considerable overhead.
The compile time method doesnt add much either, but I would (personally) do it at runtime and have a simpler script.
If you're wanting to save yourself the trouble I just included getversion.nsi in the Registration plugin (see the wiki in Plugins). It's written for you and creates a macro you can insert directly into your compiler. An example of how to use it is also included.