@@ -11,9 +11,14 @@ Name "${PRODUCT_NAME}"
1111VIProductVersion " ${PRODUCT_VERSION}"
1212OutFile " dist\${OUTFILE_NAME}"
1313
14+ !define UNINSTKEY " Software\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)"
15+ !define MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_KEY " ${UNINSTKEY}"
16+ !define MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_VALUENAME " CurrentUser"
17+ !define MULTIUSER_INSTALLMODE_INSTDIR " ANSYS Inc\$(^Name)"
18+ !define MULTIUSER_INSTALLMODE_COMMANDLINE
1419!define MULTIUSER_EXECUTIONLEVEL Highest
1520!define MULTIUSER_MUI
16- !define MULTIUSER_INSTALLMODE_COMMANDLINE
21+
1722!include MultiUser.nsh
1823!include MUI2.nsh
1924!include InstallOptions.nsh
@@ -45,11 +50,10 @@ FunctionEnd
4550
4651; Define the installer sections
4752Section " Ansys Python Manager" SEC01
48- ; Set the installation directory to the program files directory
49- SetOutPath " $PROGRAMFILES64\ANSYS Inc\Ansys Python Manager "
53+ ; Set the installation directory dynamically based on user mode
54+ SetOutPath " $INSTDIR "
5055
5156 ; Copy the files from the dist\ansys_python_manager directory
52- ; File /r /oname=ignore "dist\ansys_python_manager\*"
5357 File /r " dist\ansys_python_manager\*"
5458
5559 ; Create the start menu directory
@@ -59,36 +63,24 @@ Section "Ansys Python Manager" SEC01
5963 CreateShortCut " $SMPROGRAMS\Ansys Python Manager\Ansys Python Manager.lnk" " $INSTDIR\Ansys Python Manager.exe"
6064
6165 ; Add the program to the installed programs list
62- WriteRegStr HKLM " Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" " DisplayName" " ${PRODUCT_NAME}"
63- WriteRegStr HKLM " Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" " UninstallString" " $\" $INSTDIR\uninstall.exe$\" "
64- WriteRegStr HKLM " Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" " DisplayIcon" " $\" $INSTDIR\Ansys Python Manager.exe$\" "
65- WriteRegStr HKLM " Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" " Publisher" " ANSYS Inc"
66- WriteRegStr HKLM " Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" " Version" " ${PRODUCT_VERSION}"
67- WriteRegStr HKLM " Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" " DisplayVersion" " ${PRODUCT_VERSION}"
66+ WriteRegStr SHCTX " ${UNINSTKEY}" " DisplayName" " ${PRODUCT_NAME}"
67+ WriteRegStr SHCTX " ${UNINSTKEY}" " UninstallString" " $INSTDIR\uninstall.exe"
68+ WriteRegStr SHCTX " ${UNINSTKEY}" " DisplayIcon" " $INSTDIR\Ansys Python Manager.exe"
69+ WriteRegStr SHCTX " ${UNINSTKEY}" " Publisher" " ANSYS Inc"
70+ WriteRegStr SHCTX " ${UNINSTKEY}" " Version" " ${PRODUCT_VERSION}"
71+ WriteRegStr SHCTX " ${UNINSTKEY}" " DisplayVersion" " ${PRODUCT_VERSION}"
72+ WriteRegStr ShCtx " ${UNINSTKEY}" $MultiUser .InstallMode 1
6873
6974 WriteUninstaller " $INSTDIR\uninstall.exe"
7075
7176SectionEnd
7277
73- ; Define the uninstaller section
74- Section " Uninstall" SEC02
75-
76- Delete " $PROGRAMFILES64\Ansys Python Manager\*.*"
77- RMDir " $PROGRAMFILES64\Ansys Python Manager"
78- DeleteRegKey HKLM " Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
79- Delete " $SMPROGRAMS\Ansys Python Manager\Ansys Python Manager.lnk"
80- RMDir " $SMPROGRAMS\Ansys Python Manager"
81- Delete " $desktop\Ansys Python Manager.lnk"
82- SectionEnd
83-
8478Icon " dist\ansys_python_manager\_internal\assets\pyansys_icon.ico"
85- InstallDir " $PROGRAMFILES64\ANSYS Inc\Ansys Python Manager"
8679
8780; Define the custom functions for the MUI2 OneClick plugin
8881InstProgressFlags smooth
8982Function oneclickpre
9083 !insertmacro MUI_HEADER_TEXT " Installing ${PRODUCT_NAME}" " Please wait while the installation completes."
91- ; !define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"
9284 HideWindow
9385FunctionEnd
9486
0 commit comments