diff --git a/python/edu/build/idea.nsi b/python/edu/build/idea.nsi index 688d9bc40aaf..ffdc1ead3a51 100644 --- a/python/edu/build/idea.nsi +++ b/python/edu/build/idea.nsi @@ -347,7 +347,7 @@ FunctionEnd !insertmacro MUI_PAGE_WELCOME Page custom uninstallOldVersionDialog - +Var productDir Var control_fields Var max_fields @@ -686,7 +686,25 @@ skip_default_instdir: FunctionEnd -Function DoAssociation +Function ProductRegistration + StrCmp "${PRODUCT_WITH_VER}" "${MUI_PRODUCT} ${VER_BUILD}" eapInfo releaseInfo +eapInfo: + StrCpy $3 "${PRODUCT_WITH_VER}(EAP)" + goto createRegistration +releaseInfo: + StrCpy $3 "${PRODUCT_WITH_VER}" +createRegistration: + StrCpy $0 "HKCR" + StrCpy $1 "Applications\${PRODUCT_EXE_FILE}\shell\open" + StrCpy $2 "FriendlyAppName" + call OMWriteRegStr + StrCpy $1 "Applications\${PRODUCT_EXE_FILE}\shell\open\command" + StrCpy $2 "" + StrCpy $3 '$INSTDIR\bin\${PRODUCT_EXE_FILE} "%1"' + call OMWriteRegStr +FunctionEnd + +Function ProductAssociation ; back up old value of an association ReadRegStr $1 HKCR $R4 "" StrCmp $1 "" skip_backup @@ -816,12 +834,16 @@ get_user_choice: !insertmacro INSTALLOPTIONS_READ $R3 "Desktop.ini" "Field $R2" "State" StrCmp $R3 1 "" next_association !insertmacro INSTALLOPTIONS_READ $R4 "Desktop.ini" "Field $R2" "Text" - call DoAssociation + call ProductAssociation next_association: IntOp $R2 $R2 + 1 IntCmp $R1 $R2 get_user_choice done get_user_choice -done: +done: + ;registration application to be presented in Open With list + call ProductRegistration + ;reset icon cache + System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)' !insertmacro MUI_STARTMENU_WRITE_BEGIN Application ; $STARTMENU_FOLDER stores name of IDEA folder in Start Menu, ; save it name in the "MenuFolder" RegValue @@ -852,8 +874,8 @@ done: StrCmp $0 "" 0 "${Index}-Skip" WriteRegStr HKCR "IntelliJIdeaProjectFile" "" "IntelliJ IDEA Project File" WriteRegStr HKCR "IntelliJIdeaProjectFile\shell" "" "open" - WriteRegStr HKCR "IntelliJIdeaProjectFile\DefaultIcon" "" "$INSTDIR\bin\idea.exe,0" "${Index}-Skip:" + WriteRegStr HKCR "IntelliJIdeaProjectFile\DefaultIcon" "" "$INSTDIR\bin\${PRODUCT_EXE_FILE},0" WriteRegStr HKCR "IntelliJIdeaProjectFile\shell\open\command" "" \ '$INSTDIR\bin\${PRODUCT_EXE_FILE} "%1"' !undef Index @@ -1004,6 +1026,7 @@ FunctionEnd ;------------------------------------------------------------------------------ Function un.onInit + StrCpy $baseRegKey "HKCU" ;admin perm. is required to uninstall? ${UnStrStr} $R0 $INSTDIR $PROGRAMFILES StrCmp $R0 $INSTDIR requred_admin_perm UAC_Done @@ -1046,33 +1069,6 @@ UAC_Done: !insertmacro INSTALLOPTIONS_EXTRACT "DeleteSettings.ini" FunctionEnd -Function OMEnumRegKey - StrCmp $0 "HKCU" hkcu - EnumRegKey $3 HKLM $1 $4 - goto done -hkcu: - EnumRegKey $3 HKCU $1 $4 -done: -FunctionEnd - -Function un.OMReadRegStr - StrCmp $0 "HKCU" hkcu - ReadRegStr $3 HKLM $1 $2 - goto done -hkcu: - ReadRegStr $3 HKCU $1 $2 -done: -FunctionEnd - -Function un.OMDeleteRegValue - StrCmp $0 "HKCU" hkcu - DeleteRegValue HKLM $1 $2 - goto done -hkcu: - DeleteRegValue HKCU $1 $2 -done: -FunctionEnd - Function un.ReturnBackupRegValue ;replace Default str with the backup value (if there is the one) and then delete backup ; $1 - key (for example ".java") @@ -1086,34 +1082,6 @@ noBackup: Pop $0 FunctionEnd -Function un.OMDeleteRegKeyIfEmpty - StrCmp $0 "HKCU" hkcu - DeleteRegKey /ifempty HKLM $1 - goto done -hkcu: - DeleteRegKey /ifempty HKCU $1 -done: -FunctionEnd - -Function un.OMDeleteRegKey - StrCmp $0 "HKCU" hkcu - DeleteRegKey /ifempty HKLM $1 - goto done -hkcu: - DeleteRegKey /ifempty HKCU $1 -done: -FunctionEnd - -Function un.OMWriteRegStr - StrCmp $0 "HKCU" hkcu - WriteRegStr HKLM $1 $2 $3 - goto done -hkcu: - WriteRegStr HKCU $1 $2 $3 -done: -FunctionEnd - - ;------------------------------------------------------------------------------ ; custom uninstall pages ;------------------------------------------------------------------------------ @@ -1198,6 +1166,7 @@ FunctionEnd Section "Uninstall" + StrCpy $productDir $INSTDIR StrCpy $baseRegKey "HKCU" ; Uninstaller is in the \bin directory, we need upper level dir StrCpy $INSTDIR $INSTDIR\.. @@ -1254,7 +1223,6 @@ skip_delete_settings: StrCmp $R9 "" "" clear_shortcuts ReadRegStr $R9 HKLM "Software\${MANUFACTURER}\${PRODUCT_REG_VER}" "MenuFolder" StrCmp $R9 "" clear_Registry - StrCpy $baseRegKey "HKLM" StrCpy $5 "Software\${MANUFACTURER}" ; call un.winVersion ; ${If} $0 == "1" @@ -1279,10 +1247,10 @@ keep_current_user: clear_Registry: StrCpy $5 "Software\${MANUFACTURER}" -; call un.winVersion -; ${If} $0 == "1" -; StrCpy $5 "Software\Wow6432Node\${MANUFACTURER}" -; ${EndIf} + call un.winVersion + ${If} $0 == "1" + StrCpy $5 "Software\Wow6432Node\${MANUFACTURER}" + ${EndIf} StrCpy $0 $baseRegKey StrCpy $1 "$5\${PRODUCT_REG_VER}" @@ -1300,14 +1268,13 @@ loop: Call un.ReturnBackupRegValue goto loop finish_uninstall: + StrCpy $0 $baseRegKey StrCpy $1 "$5\${PRODUCT_REG_VER}" StrCpy $2 "Build" - Call un.OMDeleteRegValue - StrCpy $2 "" - Call un.OMDeleteRegValue + Call un.OMReadRegStr StrCpy $1 "$5\${PRODUCT_REG_VER}" - Call un.OMDeleteRegKeyIfEmpty + Call un.OMDeleteRegKey StrCpy $1 "$5\${MUI_PRODUCT}" Call un.OMDeleteRegKeyIfEmpty @@ -1315,6 +1282,24 @@ finish_uninstall: StrCpy $1 "$5" Call un.OMDeleteRegKeyIfEmpty + StrCpy $0 "HKCR" + StrCpy $1 "Applications\${PRODUCT_EXE_FILE}" + StrCpy $2 "" + Call un.OMDeleteRegKey + StrCpy $0 "HKCR" + StrCpy $1 "${PRODUCT_PATHS_SELECTOR}" + StrCpy $2 "" + Call un.OMDeleteRegKey + + StrCpy $0 "HKCR" + StrCpy $1 "IntelliJIdeaProjectFile\DefaultIcon" + StrCpy $2 "" + call un.OMReadRegStr + StrCmp $3 "$productDir\${PRODUCT_EXE_FILE},0" remove_IntelliJIdeaProjectFile done +remove_IntelliJIdeaProjectFile: + StrCpy $1 "IntelliJIdeaProjectFile" + Call un.OMDeleteRegKey +done: DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_WITH_VER}" ; UNCOMMENT THIS IN RELEASE BUILD