NSIS Develop, Deploy 32 bit applications to 64 bit Windows?
I think I am close. For 32 bit I can install, run and uninstall.
For 64 bit (Win7 x64) I can install, run but uninstall only the application, not the data.
x64 requires two 'install directories', one for the app and one for any data created by the app (including its .ini file) In addition to the $INSTDIR variable, I defined another: $DATADIR
What am I missing?
Here are parts of the script that almost works:
var /GLOBAL DATADIR
:
:
Function dir_pge_txt_dest
${If} ${AtLeastWinVista}
!define $MUI_DIRECTORYPAGE_TEXT_DESTINATION "Setup will install ${MUI_PRODUCT} ${MUI_VERSION} in the Following folder. To install in a difFerent folder, click Browse and select another Folder. Click Install to start the installation. It is imperative to install into the C:\Users\Public\... folder structure! "
${EndIf}
FunctionEnd
Function .onVerifyInstDir
${If} ${RunningX64}
${Else}
StrCpy $DATADIR $INSTDIR
${EndIf}
FunctionEnd
:
:
:
!define MUI_WELCOMEPAGE
!define MUI_LICENSEPAGE
!define MUI_DIRECTORYPAGE
!define MUI_ABORTWARNING
!define MUI_UNINSTALLER
!define MUI_UNCONFIRMPAGE
!define MUI_FINISHPAGE
Function .onInit
${If} ${AtLeastWinVista}
${If} ${RunningX64}
StrCpy $INSTDIR "$PROGRAMFILES32\Clark_Anderson\${MUI_FILE}"
StrCpy $DATADIR "C:\Users\Public\Clark_Anderson\${MUI_FILE}"
${Else}
StrCpy $INSTDIR "C:\Users\Public\Clark_Anderson\${MUI_FILE}"
StrCpy $DATADIR "C:\Users\Public\Clark_Anderson\${MUI_FILE}"
${EndIf}
${Else}
StrCpy $INSTDIR "$PROGRAMFILES\Clark_Anderson\${MUI_FILE}"
StrCpy $DATADIR "$PROGRAMFILES\Clark_Anderson\${MUI_FILE}"
${EndIf}
FunctionEnd
:
:
:
Section "Sample Data Files (Optional: Recommended for starting)"
SectionIn 2
SetOutPath "$DATADIR\DataBases"
:
:
SectionEnd
Section "Uninstall"
:
:
:
:
;Delete Files
Delete "$INSTDIR\*.*"
Delete "$DATADIR\Reports\Templates\*.*"
Delete "$DATADIR\Reports\*.*"
Delete "$DATADIR\DataBases\*.*"
Delete "$DATADIR\ExpImport\*.*"
Delete "$DATADIR\*.*"
;Remove the installation directory
RMDir /r "$INSTDIR"
RMDir /r "$DATADIR\Reports\Templates\*.*"
RMDir /r "$DATADIR\Reports\*.*"
RMDir /r "$DATADIR\DataBases\*.*"
RMDir /r "$DATADIR\ExpImport\*.*"
RMDir /r "$DATADIR"
;Delete Start Menu Shortcuts
Delete "$DESKTOP\${MUI_PRODUCT}.lnk"
Delete "$SMPROGRAMS\${MUI_PRODUCT}\*.*"
RmDir "$SMPROGRAMS\${MUI_PRODUCT}"
;Delete Uninstaller And Unistall Registry Entries
DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\${MUI_PRODUCT}"
DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${MUI_PRODUCT}"
SectionEnd
:
: