Archive: NSISdl deletes files


NSISdl deletes files
the following error occurs with my script (NSIS 2.0 beta 3a).

the installer downloads additional files using NSISdl:

Section "Color Map APE" ColorMap
SetOutPath "$INSTDIR\$1\"
SectionIn 1
IfFileExists "$INSTDIR\$1\colormap.ape" ExistMessage CopyAPE
ExistMessage:
MessageBox MB_YESNO|MB_ICONEXCLAMATION "Setup detected the Color \
Map APE in your Plugins directory.$\n$\nOverwrite anyway?" IDNO End
CopyAPE:
NSISdl::download /TIMEOUT=30000 http://my.url/colormap.ape "$INSTDIR\$1\colormap.ape"
End:
SectionEnd


when the user is connected to the internet, the installer works charmingly. but when the user is offline and tries to overwrite the existing colormap.ape, the file simply gets deleted.

is this a bug in NSISdl? can i add something to my script to prevent this?

NSISdl deletes the created file in case of an error so there won't be any corrupted files left behind. It's by design, it's not a bug.

To check for an internet connection use the Dialer DLL. You can find an example in its readme.

It's also recommended you first download the file to a temporary directory such as $PLUGINSDIR and only once you have made sure you got the right file and there were no errors you should copy it to its destination.