create desktop shortcut for 64 exe launcher.

This commit is contained in:
Vladimir.Orlov
2016-02-08 16:26:13 +03:00
parent abfb139fb0
commit d18f597831
6 changed files with 102 additions and 84 deletions
+26 -8
View File
@@ -1,23 +1,41 @@
!define INSTALL_OPTION_ELEMENTS 4
!define JAVA_REQUIREMENT 1.8
Function customInstallActions
DetailPrint "There are no custom install actions."
FunctionEnd
Function searchJava64
StrCpy $0 "HKLM"
StrCpy $1 "Software\JavaSoft\Java Development Kit\${JAVA_REQUIREMENT}"
StrCpy $2 "JavaHome"
SetRegView 64
call OMReadRegStr
SetRegView 32
StrCpy $3 "$3\bin\java.exe"
IfFileExists $3 0 no_java_64
goto done
no_java_64:
StrCpy $3 ""
done:
FunctionEnd
Function ConfirmDesktopShortcut
!insertmacro MUI_HEADER_TEXT "$(installation_options)" "$(installation_options_prompt)"
!insertmacro INSTALLOPTIONS_WRITE "Desktop.ini" "Field 1" "Text" "$(create_desktop_shortcut)"
call winVersion
${If} $0 == "1"
!insertmacro INSTALLOPTIONS_WRITE "Desktop.ini" "Field 2" "Type" "Label"
!insertmacro INSTALLOPTIONS_WRITE "Desktop.ini" "Field 2" "Text" ""
!insertmacro INSTALLOPTIONS_WRITE "Desktop.ini" "Field 2" "Text" "${PRODUCT_EXE_FILE}"
${StrRep} $R0 ${PRODUCT_EXE_FILE_64} "64.exe" ".exe"
${If} $R0 == ${PRODUCT_EXE_FILE}
call searchJava64
${If} $3 != ""
!insertmacro INSTALLOPTIONS_WRITE "Desktop.ini" "Field 3" "Text" "${PRODUCT_EXE_FILE_64}"
${EndIf}
${Else}
!insertmacro INSTALLOPTIONS_WRITE "Desktop.ini" "Field 2" "Text" "$(create_quick_launch_shortcut)"
;there is no java 64 or product launcher for 64 java
!insertmacro INSTALLOPTIONS_WRITE "Desktop.ini" "Field 3" "Type" "Label"
!insertmacro INSTALLOPTIONS_WRITE "Desktop.ini" "Field 3" "Text" ""
${EndIf}
StrCmp "${ASSOCIATION}" "NoAssociation" skip_association
StrCpy $R0 3
StrCpy $R0 ${INSTALL_OPTION_ELEMENTS}
push "${ASSOCIATION}"
loop:
call SplitStr
+50 -42
View File
@@ -1,74 +1,82 @@
[Settings]
NumFields=3
NumFields=4
[Field 1]
Type=checkbox
Left=5
Right=100
Top=10
Bottom=20
State=0
[Field 2]
Type=checkbox
Left=120
Right=-1
Top=10
Bottom=20
State=0
[Field 3]
Type=GroupBox
Left=1
Right=-1
Top=35
Bottom=65
Text=Create associations
Top=10
Bottom=40
Text=Create Desktop shortcut
[Field 4]
[Field 2]
Type=checkbox
Left=5
Right=45
Top=50
Bottom=60
Right=105
Top=20
Bottom=30
State=0
[Field 3]
Type=checkbox
Left=115
Right=215
Top=20
Bottom=30
State=0
[Field 4]
Type=GroupBox
Left=1
Right=-1
Top=45
Bottom=75
Text=Create associations
[Field 5]
Type=checkbox
Left=50
Right=90
Top=50
Bottom=60
Left=5
Right=45
Top=60
Bottom=70
State=0
[Field 6]
Type=checkbox
Left=95
Right=135
Top=50
Bottom=60
Left=50
Right=90
Top=60
Bottom=70
State=0
[Field 7]
Type=checkbox
Left=140
Right=180
Top=50
Bottom=60
Left=95
Right=135
Top=60
Bottom=70
State=0
[Field 8]
Type=checkbox
Left=185
Right=225
Top=50
Bottom=60
Left=140
Right=180
Top=60
Bottom=70
State=0
[Field 9]
Type=checkbox
Left=185
Right=225
Top=60
Bottom=70
State=0
[Field 10]
Type=checkbox
Left=230
Right=270
Top=50
Bottom=60
Top=60
Bottom=70
State=0
+23 -34
View File
@@ -27,13 +27,13 @@ RequestExecutionLevel user
!include StrFunc.nsh
!include LogicLib.nsh
!include "customInstallActions.nsi"
${UnStrStr}
${UnStrLoc}
${UnStrRep}
${StrRep}
!include "customInstallActions.nsi"
ReserveFile "desktop.ini"
ReserveFile "DeleteSettings.ini"
ReserveFile '${NSISDIR}\Plugins\InstallOptions.dll'
@@ -55,8 +55,8 @@ ReserveFile '${NSISDIR}\Plugins\InstallOptions.dll'
Var baseRegKey
Var IS_UPGRADE_60
!define MUI_LANGDLL_REGISTRY_ROOT "HKCU"
!define MUI_LANGDLL_REGISTRY_KEY "Software\JetBrains\${MUI_PRODUCT}\${VER_BUILD}\"
!define MUI_LANGDLL_REGISTRY_ROOT "HKCU"
!define MUI_LANGDLL_REGISTRY_KEY "Software\JetBrains\${MUI_PRODUCT}\${VER_BUILD}\"
!define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language"
@@ -419,7 +419,7 @@ UAC_Admin:
StrCpy $INSTDIR "$PROGRAMFILES\${MANUFACTURER}\${PRODUCT_WITH_VER}"
SetShellVarContext all
StrCpy $baseRegKey "HKLM"
UAC_Done:
UAC_Done:
; !insertmacro MUI_LANGDLL_DISPLAY
FunctionEnd
@@ -462,7 +462,7 @@ Function searchCurrentVersion
StrCmp $0 "complete" Done
StrCpy $0 "HKLM"
Call checkVersion
Done:
Done:
FunctionEnd
@@ -597,7 +597,7 @@ getPath:
StrCpy $1 "$1\$3"
Call OMReadRegStr
Pop $1
IfFileExists $3$5 done 0
IfFileExists $3$5 done 0
IntOp $4 $4 + 1
goto loop
done:
@@ -649,12 +649,12 @@ enum_versions_hkcu:
IntCmp $1 $3 continue_enum_versions_hkcu continue_enum_versions_hkcu
StrCpy $3 $1
ReadRegStr $INSTDIR "HKCU" "Software\${MANUFACTURER}\${MUI_PRODUCT}\$3" ""
continue_enum_versions_hkcu:
IntOp $0 $0 + 1
Goto enum_versions_hkcu
end_enum_versions_hkcu:
end_enum_versions_hkcu:
StrCpy $0 "0" # registry key index
@@ -664,11 +664,11 @@ enum_versions_hklm:
IntCmp $1 $3 continue_enum_versions_hklm continue_enum_versions_hklm
StrCpy $3 $1
ReadRegStr $INSTDIR "HKLM" "Software\${MANUFACTURER}\${MUI_PRODUCT}\$3" ""
continue_enum_versions_hklm:
IntOp $0 $0 + 1
Goto enum_versions_hklm
end_enum_versions_hklm:
StrCmp $INSTDIR "" 0 skip_default_instdir
@@ -726,30 +726,19 @@ FunctionEnd
; Installer sections
;------------------------------------------------------------------------------
Section "IDEA Files" CopyIdeaFiles
; StrCpy $baseRegKey "HKCU"
; !insertmacro INSTALLOPTIONS_READ $R2 "Desktop.ini" "Field 3" "State"
; StrCmp $R2 1 continue_for_current_user
; SetShellVarContext all
; StrCpy $baseRegKey "HKLM"
; continue_for_current_user:
; create shortcuts
!insertmacro INSTALLOPTIONS_READ $R2 "Desktop.ini" "Field 1" "State"
StrCmp $R2 1 "" skip_desktop_shortcut
!insertmacro INSTALLOPTIONS_READ $R2 "Desktop.ini" "Field 2" "State"
StrCmp $R2 1 "" exe_64
CreateShortCut "$DESKTOP\${PRODUCT_FULL_NAME_WITH_VER}.lnk" \
"$INSTDIR\bin\${PRODUCT_EXE_FILE}" "" "" "" SW_SHOWNORMAL
exe_64:
!insertmacro INSTALLOPTIONS_READ $R2 "Desktop.ini" "Field 3" "State"
StrCmp $R2 1 "" skip_desktop_shortcut
CreateShortCut "$DESKTOP\${PRODUCT_FULL_NAME_WITH_VER}(64).lnk" \
"$INSTDIR\bin\${PRODUCT_EXE_FILE_64}" "" "" "" SW_SHOWNORMAL
skip_desktop_shortcut:
; OS is not win7
Call winVersion
${If} $0 == "0"
!insertmacro INSTALLOPTIONS_READ $R2 "Desktop.ini" "Field 2" "State"
StrCmp $R2 1 "" skip_quicklaunch_shortcut
CreateShortCut "$QUICKLAUNCH\${PRODUCT_FULL_NAME_WITH_VER}.lnk" \
"$INSTDIR\bin\${PRODUCT_EXE_FILE}" "" "" "" SW_SHOWNORMAL
${EndIf}
skip_quicklaunch_shortcut:
!insertmacro INSTALLOPTIONS_READ $R1 "Desktop.ini" "Settings" "NumFields"
IntCmp $R1 ${INSTALL_OPTION_ELEMENTS} do_association done do_association
do_association:
@@ -765,7 +754,7 @@ next_association:
done:
Call customInstallActions
Call customInstallActions
;registration application to be presented in Open With list
call ProductRegistration
@@ -947,7 +936,7 @@ Function un.ReturnBackupRegValue
StrCmp $0 "" "noBackup"
WriteRegStr HKCR $1 "" $0
DeleteRegValue HKCR $1 $2
noBackup:
noBackup:
Pop $0
FunctionEnd
@@ -1111,14 +1100,14 @@ shortcuts:
SetShellVarContext all
keep_current_user:
DetailPrint "Start Menu: $SMPROGRAMS\$R9\${PRODUCT_FULL_NAME_WITH_VER}"
Delete "$SMPROGRAMS\$R9\${PRODUCT_FULL_NAME_WITH_VER}.lnk"
; Delete "$SMPROGRAMS\$R9\Uninstall ${PRODUCT_FULL_NAME_WITH_VER}.lnk"
; Delete only if empty (last IDEA version is uninstalled)
RMDir "$SMPROGRAMS\$R9"
Delete "$DESKTOP\${PRODUCT_FULL_NAME_WITH_VER}.lnk"
Delete "$QUICKLAUNCH\${PRODUCT_FULL_NAME_WITH_VER}.lnk"
Delete "$DESKTOP\${PRODUCT_FULL_NAME_WITH_VER}(64).lnk"
registry:
StrCpy $5 "Software\${MANUFACTURER}"
+1
View File
@@ -2,6 +2,7 @@
!define MUI_PRODUCT "IntelliJ IDEA"
!define PRODUCT_FULL_NAME "IntelliJ IDEA"
!define PRODUCT_EXE_FILE "idea.exe"
!define PRODUCT_EXE_FILE_64 "idea64.exe"
!define PRODUCT_ICON_FILE "idea_inst.ico"
!define PRODUCT_UNINST_ICON_FILE "idea_uninst.ico"
!define PRODUCT_LOGO_FILE "logo.bmp"
+1
View File
@@ -2,6 +2,7 @@
!define MUI_PRODUCT "IntelliJ IDEA Community Edition"
!define PRODUCT_FULL_NAME "IntelliJ IDEA Community Edition"
!define PRODUCT_EXE_FILE "idea.exe"
!define PRODUCT_EXE_FILE_64 "idea64.exe"
!define PRODUCT_ICON_FILE "idea_CEinst.ico"
!define PRODUCT_UNINST_ICON_FILE "idea_CEuninst.ico"
!define PRODUCT_LOGO_FILE "logoCE.bmp"
+1
View File
@@ -2,6 +2,7 @@
!define MUI_PRODUCT "PyCharm Community Edition"
!define PRODUCT_FULL_NAME "JetBrains PyCharm Community Edition"
!define PRODUCT_EXE_FILE "pycharm.exe"
!define PRODUCT_EXE_FILE_64 "pycharm64.exe"
!define PRODUCT_ICON_FILE "PC_instCom.ico"
!define PRODUCT_UNINST_ICON_FILE "PC_uninstCom.ico"
!define PRODUCT_LOGO_FILE "logo.bmp"