Refactor Windows installer shortcut creation process
All checks were successful
farmcontrol/farmcontrol-ui/pipeline/head This commit looks good
All checks were successful
farmcontrol/farmcontrol-ui/pipeline/head This commit looks good
- Removed the `fixShortcutWorkingDir` macro to simplify the shortcut creation logic. - Updated `createDesktopShortcut` and `createStartMenuShortcut` macros to directly set the output path for shortcuts, enhancing clarity and maintainability.
This commit is contained in:
parent
debf6802ce
commit
2383d14a80
@ -42,40 +42,17 @@
|
|||||||
done_uninstall:
|
done_uninstall:
|
||||||
!macroend
|
!macroend
|
||||||
|
|
||||||
!macro fixShortcutWorkingDir SHORTCUT_PATH WORKING_DIR
|
|
||||||
Push $0
|
|
||||||
Push $1
|
|
||||||
Push $2
|
|
||||||
StrCpy $1 "${SHORTCUT_PATH}"
|
|
||||||
StrCpy $2 "${WORKING_DIR}"
|
|
||||||
InitPluginsDir
|
|
||||||
FileOpen $0 "$PLUGINSDIR\fix-shortcut.ps1" w
|
|
||||||
FileWrite $0 '$$s = (New-Object -COM WScript.Shell).CreateShortcut("'
|
|
||||||
FileWrite $0 $1
|
|
||||||
FileWrite $0 '")$\r$\n'
|
|
||||||
FileWrite $0 '$$s.WorkingDirectory = "'
|
|
||||||
FileWrite $0 $2
|
|
||||||
FileWrite $0 '"$\r$\n'
|
|
||||||
FileWrite $0 '$$s.Save()$\r$\n'
|
|
||||||
FileClose $0
|
|
||||||
ExecWait '"$SYSDIR\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -ExecutionPolicy Bypass -File "$PLUGINSDIR\fix-shortcut.ps1"'
|
|
||||||
Delete "$PLUGINSDIR\fix-shortcut.ps1"
|
|
||||||
Pop $2
|
|
||||||
Pop $1
|
|
||||||
Pop $0
|
|
||||||
!macroend
|
|
||||||
|
|
||||||
!macro createDesktopShortcut
|
!macro createDesktopShortcut
|
||||||
SetShellVarContext current
|
SetShellVarContext current
|
||||||
|
SetOutPath "$INSTDIR\bin"
|
||||||
CreateShortCut "$DESKTOP\Farm Control.lnk" "$INSTDIR\bin\launcher.exe" "" "$INSTDIR\bin\launcher.exe" 0 SW_SHOWNORMAL "" "Farm Control"
|
CreateShortCut "$DESKTOP\Farm Control.lnk" "$INSTDIR\bin\launcher.exe" "" "$INSTDIR\bin\launcher.exe" 0 SW_SHOWNORMAL "" "Farm Control"
|
||||||
!insertmacro fixShortcutWorkingDir "$DESKTOP\Farm Control.lnk" "$INSTDIR\bin"
|
|
||||||
!macroend
|
!macroend
|
||||||
|
|
||||||
!macro createStartMenuShortcut
|
!macro createStartMenuShortcut
|
||||||
SetShellVarContext current
|
SetShellVarContext current
|
||||||
CreateDirectory "$SMPROGRAMS\Farm Control"
|
CreateDirectory "$SMPROGRAMS\Farm Control"
|
||||||
|
SetOutPath "$INSTDIR\bin"
|
||||||
CreateShortCut "$SMPROGRAMS\Farm Control\Farm Control.lnk" "$INSTDIR\bin\launcher.exe" "" "$INSTDIR\bin\launcher.exe" 0 SW_SHOWNORMAL "" "Farm Control"
|
CreateShortCut "$SMPROGRAMS\Farm Control\Farm Control.lnk" "$INSTDIR\bin\launcher.exe" "" "$INSTDIR\bin\launcher.exe" 0 SW_SHOWNORMAL "" "Farm Control"
|
||||||
!insertmacro fixShortcutWorkingDir "$SMPROGRAMS\Farm Control\Farm Control.lnk" "$INSTDIR\bin"
|
|
||||||
!macroend
|
!macroend
|
||||||
|
|
||||||
!macro removeDesktopShortcut
|
!macro removeDesktopShortcut
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user