Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions build/installer.nsh
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,24 @@
Var DshDirectoryEdit
Var DshDirectoryNormalizationActive

; MUI invokes this after the assisted installer's directory page is ready.
; Normalize a selected drive root immediately so the page does not reject it
; before electron-builder's later install-time sanitization can run.
; electron-builder declares its install-mode page before the directory page.
; MUI consumes this callback on that first page, so use it to start a short
; polling timer and attach to the directory edit control once that page exists.
!define MUI_PAGE_CUSTOMFUNCTION_SHOW DshDirectoryPageShow

Function DshDirectoryPageShow
${NSD_CreateTimer} DshAttachDirectoryPage 50
FunctionEnd

Function DshAttachDirectoryPage
FindWindow $DshDirectoryPage "#32770" "" $HWNDPARENT
GetDlgItem $DshDirectoryEdit $DshDirectoryPage 1019

${If} $DshDirectoryEdit == 0
Return
${EndIf}

${NSD_KillTimer} DshAttachDirectoryPage
${NSD_OnChange} $DshDirectoryEdit DshDirectoryChanged
Call DshNormalizeDriveRoot
FunctionEnd
Expand All @@ -39,7 +49,7 @@
${If} $2 != ":"
Return
${EndIf}
StrCpy $3 "$0\${APP_FILENAME}"
StrCpy $3 "$0\DSH Desktop"
${ElseIf} $1 == 3
StrCpy $2 $0 1 1
${If} $2 != ":"
Expand All @@ -49,7 +59,7 @@
${If} $2 != "\"
Return
${EndIf}
StrCpy $3 "$0${APP_FILENAME}"
StrCpy $3 "$0DSH Desktop"
${Else}
Return
${EndIf}
Expand Down
6 changes: 4 additions & 2 deletions test/release.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,11 @@ describe('GitHub release contract', () => {
)

expect(installer).toContain('!define MUI_PAGE_CUSTOMFUNCTION_SHOW DshDirectoryPageShow')
expect(installer).toContain('${NSD_CreateTimer} DshAttachDirectoryPage 50')
expect(installer).toContain('${NSD_KillTimer} DshAttachDirectoryPage')
expect(installer).toContain('${NSD_OnChange} $DshDirectoryEdit DshDirectoryChanged')
expect(installer).toContain('StrCpy $3 "$0\\${APP_FILENAME}"')
expect(installer).toContain('StrCpy $3 "$0${APP_FILENAME}"')
expect(installer).toContain('StrCpy $3 "$0\\DSH Desktop"')
expect(installer).toContain('StrCpy $3 "$0DSH Desktop"')
expect(installer).toContain('${NSD_SetText} $DshDirectoryEdit $3')
})

Expand Down
Loading