Archive: Detect skipped file


Detect skipped file
In one of my patch installers, using NSIS 2.9, I need to copy in an updated file and then execute that file. I would like to skip the execution if the file replacement was skipped (already up-to-date). I found a mention in the forum that the error flag would be set if the file was skipped. My code fragment is as follows:

SetOverwrite ifnewer
ClearErrors
File "SETUPEX.EXE"
IfErrors +4 0
ExecWait "$INSTDIR\SETUPEX.EXE"
IfErrors 0 +2
SetRebootFlag true

I find however that ExecWait is always being called, even when the file has been skipped, so I am assuming that the error flag is not being set. Is there any other way to determine if the file was skipped so I can skip the execution ?


Bump


The error flag is only set for the "try" mode. If you want to use ifnewer and know when the file is not overwritten, you'd have to compare dates yourself. Use GetFileTime and GetFileTimeLocal to do so.


Thanks for the help, will see what I can do with those two functions.

Cheers,
Brett