Skip to content
⌘ NSIS Forum Archive

setoverwrite by version

5 posts

charlies#

setoverwrite by version

In the past, I have used InstallShield and it had a way to specify file overwrite by (VERSION | DATE) where a file would be overwritten if the new file had a greater version than the old file, independent of the date/time stamp. I assumed, wrongly I believe, that the 'SetOverwrite ifnewer' would take file version (if avaible) into account. Is there a simple way to ensure that a file is overwritten if the source file has a newer version than the destination?

- Charlie
Dkom#
> Is there a simple way to ensure that a file is overwritten

You can set "SetOverwrite on" - and it will be always overwritten. If file is blocked (by system, or currently is running) - installer will notify you.
charlies#
I realize that, but I only want to override if the file is newer. I would like the definition of 'newer' to be 1) first version 2) then date if necessary. If this does capability not exist, it seems like a nice feature that shouldn't be too dificult to implement. I am hoping, though, that I missed a simple mode/setting to accomplish my goal
kichik#
You can use GetDLLVersion and GetDLLVersionLocal to do the version comparsion. You can use the Library or the older UpgradeDLL macro to do this comparison for you.
charlies#
Yes, I have used those functions/macros primarily for updating system DLLs. I was just hoping that I missed some capability in the File command that would allow more control over overwriting files. It seems that I did not miss anything and will need to use something other than the File command to update my files.