NSIS installer and Vista

Miscellaneous Forums/General Discussion/NSIS installer and Vista

If you use NSIS and want to ensure you're game is installed to the correct directory for Vista compatibility you can use the following NSIS function.

Function GetCommonAppData
  Push $1
  Push $2
  Push $3
  Push $4  
 
  StrCpy $1 ""
  StrCpy $2 "0x0023" # CSIDL_COMMON_APPDATA  (0x0023)
  StrCpy $3 ""
  StrCpy $4 ""
 
  System::Call 'shell32::SHGetSpecialFolderPath(i $HWNDPARENT, t .r1, i r2, i r3) i .r4'
 
  Pop $4
  Pop $3
  Pop $2
  Exch $1
FunctionEnd


Use it like this :
Section -Files
	Call GetCommonAppData
	Pop $0
	SetOutPath "$0\Harmony\html"
	FILE /r "G:\Application Development\Harmony_ATL\html\*.*"
	SetOutPath "$0\Harmony"
	FILE "G:\Application Development\Harmony_ATL\Harmony.exe"
	FILE "G:\Application Development\Harmony_ATL\Launcher.exe"
SectionEnd