I'm attempting to make my installer backup the present file and then restore it upon uninstall, but I cannot get this to work correctly. I'm modeling my script using a sample script from another installer that I know works (I've used the installer).
I know the problem has something to do with how I've set up the directories. I know that because I can get both the backup/rename/uninstall features to work if I don't use a relative path, and instead simply point to a specific directory (in my case, H:\ME3_dummy).
Here are some snippets of the sample code I'm working off :
InstallDir "$PROGRAMFILES"Uninstall looks like this (the program previous used .bak files, but now uses .bup files):
InstallDirRegKey HKLM "Software\BioWare\Mass Effect 3" "Install Dir"
DetailPrint "copying remaining files..."
SetOverwrite on
SetOutPath "$INSTDIR\BIOGame"
IfFileExists "$INSTDIR\BIOGame\PCConsoleTOC.bin.bup" +2 0
Rename "$INSTDIR\BIOGame\PCConsoleTOC.bin" "$INSTDIR\BIOGame\PCConsoleTOC.bin.bup"
File "BIOGame\PCConsoleTOC.bin"
IfFileExists "$INSTDIR\BIOGame\PCConsoleTOC.bin.bup" 0 +4And, here's a sample of what mine looks like. In my case, the new files are copied over, but backups are not made.
Delete "$INSTDIR\BIOGame\PCConsoleTOC.bin"
Rename "$INSTDIR\BIOGame\PCConsoleTOC.bin.bup" "$INSTDIR\BIOGame\PCConsoleTOC.bin"
Goto +4
IfFileExists "$INSTDIR\BIOGame\PCConsoleTOC.bin.bak" 0 +3
Delete "$INSTDIR\BIOGame\PCConsoleTOC.bin"
Rename "$INSTDIR\BIOGame\PCConsoleTOC.bin.bak" "$INSTDIR\BIOGame\PCConsoleTOC.bin"
InstallDir "$PROGRAMFILES"And, here's a portion of my uninstall. When it comes time to uninstall, there are not any .bu2 files created, so it makes sense the new files wouldn't get uninstalled. However, the files that are simply copied/created without backups being made, also aren't being uninstalled.
InstallDirRegKey HKLM "Software\BioWare\Mass Effect 3" "Install Dir"
Section "Expanded Core Module for EC" SEC01
SectionIn RO
SetOutPath "$INSTDIR\BIOGame\CookedPCConsole"
SetOverwrite on
IfFileExists "$INSTDIR\BIOGame\CookedPCConsole\Conditionals.cnd" +2 0
Rename "$INSTDIR\BIOGame\CookedPCConsole\Conditionals.cnd" "$INSTDIR\BIOGame\CookedPCConsole\Conditionals.cnd.bu2"
File "Conditionals.cnd"
Section UninstallIf anyone is willing to take the time to help, I'd very much appreciate it.
IfFileExists "$INSTDIR\BIOGame\UNINSTALL_ThaneMOD_v1B.exe" 0 +2
Delete "$INSTDIR\BIOGame\UNINSTALL_ThaneMOD_v1B.exe"
IfFileExists "$INSTDIR\BIOGame\CookedPCConsole\BioD_CitHub_HospitalP2_LOC_INT.pcc.bu2" 0 +2
Delete "$INSTDIR\BIOGame\CookedPCConsole\BioD_CitHub_HospitalP2_LOC_INT.pcc"
Rename "$INSTDIR\BIOGame\CookedPCConsole\BioD_CitHub_HospitalP2_LOC_INT.pcc.bu2" "$INSTDIR\BIOGame\CookedPCConsole\BioD_CitHub_HospitalP2_LOC_INT.pcc"
If it is helpful, here's a pastebin of the full installer: http://pastebin.com/jy7ppHeU
Thanks much.