Skip to content
⌘ NSIS Forum Archive

Backup of files during install

3 posts

MrWhammy#

Backup of files during install

Hi,

I have the impression backups are taken of files modified on install. I use the following code:
File /oname="${EXEC_NAME}.config" "configtemplate.txt"

DetailPrint "Replacing connection string"
!insertmacro ReplaceInFile "$INSTDIR\${EXEC_NAME}.config" "&ConnectionString&" $CONNECTIONSTRING
DetailPrint "Replacing log port"
!insertmacro ReplaceInFile "$INSTDIR\${EXEC_NAME}.config" "&LogPort&" $LogPort
DetailPrint "Replacing log level"
!insertmacro ReplaceInFile "$INSTDIR\${EXEC_NAME}.config" "&LogLevel&" $LogLevel
Using ReplaceInFile

This leaves an ${EXEC_NAME}.config.old behind in the ${INSTDIR}. I'm not really getting it, i'm afraid. What's happening here and how can I avoid to leave the .old-file there?

Extract: "${EXEC_NAME}.config"... 100%
Replacing connection string
Rename: ${INSTDIR}\${EXEC_NAME}.config->${INSTDIR}\${EXEC_NAME}.old
Rename: C:\DOCUME~1\brecht\LOCALS~1\Temp\nsv8F.tmp->${INSTDIR}\${EXEC_NAME}.config
Replacing log port
Delete file: ${INSTDIR}\${EXEC_NAME}.config.old
Rename: ${INSTDIR}\${EXEC_NAME}.config->${INSTDIR}\XBAdmin1.1.exe.config.old
Rename: C:\DOCUME~1\brecht\LOCALS~1\Temp\nsa90.tmp->${INSTDIR}\${EXEC_NAME}.config
Replacing log level
Delete file: ${INSTDIR}\${EXEC_NAME}.config.old
Rename: ${INSTDIR}\${EXEC_NAME}.config->${INSTDIR}\${EXEC_NAME}.config.old
Rename: C:\DOCUME~1\brecht\LOCALS~1\Temp\nsa91.tmp->${INSTDIR}\${EXEC_NAME}.config
Created uninstaller: ${INSTDIR}\uninst.exe
Pidgeot#
Change these two lines:
Delete "$2.old"                 ; go away, Sire
Rename "$2" "$2.old"            ; step aside, Ma'am 
to
    Delete "$2" 
That should do the trick.