Installer: Prevented duplicate startup shortcut

This commit is contained in:
Birunthan Mohanathas 2012-05-05 13:00:28 +03:00
parent 73525ea999
commit 14ea42120e

View File

@ -731,13 +731,18 @@ SkipIniMove:
${EndIf} ${EndIf}
CreateShortcut "$0" "$INSTDIR\Rainmeter.exe" "" "$INSTDIR\Rainmeter.exe" 0 CreateShortcut "$0" "$INSTDIR\Rainmeter.exe" "" "$INSTDIR\Rainmeter.exe" 0
${If} $AutoStartup == 1
${If} ${FileExists} "$SMSTARTUP\Rainmeter.lnk"
; Remove user shortcut to prevent duplicate with all users shortcut
!insertmacro UAC_AsUser_Call Function RemoveUserStartupShortcut ${UAC_SYNCREGISTERS}
${Else}
!insertmacro UAC_AsUser_Call Function CreateUserStartupShortcut ${UAC_SYNCREGISTERS}
${EndIf}
${EndIf}
SetShellVarContext current SetShellVarContext current
Call RemoveStartMenuShortcuts Call RemoveStartMenuShortcuts
${If} $AutoStartup == 1
!insertmacro UAC_AsUser_Call Function CreateStartupShortcut ${UAC_SYNCREGISTERS}
${EndIf}
!insertmacro UAC_AsUser_Call Function RemoveStartMenuShortcuts ${UAC_SYNCREGISTERS} !insertmacro UAC_AsUser_Call Function RemoveStartMenuShortcuts ${UAC_SYNCREGISTERS}
WriteUninstaller "$INSTDIR\uninst.exe" WriteUninstaller "$INSTDIR\uninst.exe"
@ -763,10 +768,16 @@ Function RemoveStartMenuShortcuts
!insertmacro RemoveStartMenuShortcuts "$SMPROGRAMS\Rainmeter" !insertmacro RemoveStartMenuShortcuts "$SMPROGRAMS\Rainmeter"
FunctionEnd FunctionEnd
Function CreateStartupShortcut Function CreateUserStartupShortcut
SetShellVarContext current
CreateShortcut "$SMSTARTUP\Rainmeter.lnk" "$INSTDIR\Rainmeter.exe" "" "$INSTDIR\Rainmeter.exe" 0 CreateShortcut "$SMSTARTUP\Rainmeter.lnk" "$INSTDIR\Rainmeter.exe" "" "$INSTDIR\Rainmeter.exe" 0
FunctionEnd FunctionEnd
Function RemoveUserStartupShortcut
SetShellVarContext current
Delete "$SMSTARTUP\Rainmeter.lnk"
FunctionEnd
Function FinishRun Function FinishRun
!insertmacro UAC_AsUser_ExecShell "" "$INSTDIR\Rainmeter.exe" "" "" "" !insertmacro UAC_AsUser_ExecShell "" "$INSTDIR\Rainmeter.exe" "" "" ""
FunctionEnd FunctionEnd