fix: afterpack.js still broken on Windows -- executableName undefined on Packager #5

Merged
mohlec merged 1 commit from fix/afterpack-executable-name-undefined into slash/main 2026-07-13 20:47:30 +00:00
Owner

Answering "did we ever get Windows to build" -- no, PR #4's fix was incomplete. build-windows still failed after it merged (commit ede265f9b), now with a NEW error: ENOENT open .../win-unpacked/undefined.exe.

Root cause: context.packager.executableName is not declared on the base Packager class in this electron-builder version (checked packager.d.ts) -- it only worked for linux by coincidence (the Linux packager subclass sets it internally; win32/darwin subclasses do not), so the win32/darwin branches silently evaluated to the literal string "undefined".

Switched to packager.appInfo.productFilename -- documented, always-populated, falls back to sanitized productName ("Slash") with no config override needed. One code path for all platforms instead of three separately-behaving ones.

Answering "did we ever get Windows to build" -- no, PR #4's fix was incomplete. build-windows still failed after it merged (commit ede265f9b), now with a NEW error: ENOENT open .../win-unpacked/undefined.exe. Root cause: context.packager.executableName is not declared on the base Packager class in this electron-builder version (checked packager.d.ts) -- it only worked for linux by coincidence (the Linux packager subclass sets it internally; win32/darwin subclasses do not), so the win32/darwin branches silently evaluated to the literal string "undefined". Switched to packager.appInfo.productFilename -- documented, always-populated, falls back to sanitized productName ("Slash") with no config override needed. One code path for all platforms instead of three separately-behaving ones.
fix: afterpack.js still broken on Windows -- executableName doesn't exist on Packager
Some checks failed
Build Slash Desktop / build-macos (pull_request) Has been skipped
Build Slash Desktop / build-linux (pull_request) Failing after 1m47s
Build Slash Desktop / build-windows (pull_request) Successful in 3m54s
635013d335
The previous fix (PR #4) changed win32/darwin to use
context.packager.executableName, mirroring linux's existing code --
but that property isn't declared anywhere on the base Packager class
in this electron-builder version (checked
node_modules/app-builder-lib/out/packager.d.ts). It only ever worked
for linux because the Linux-specific packager subclass happens to set
it as an internal instance property; win32/darwin's subclasses don't,
so the expression silently evaluated to the string "undefined":

  afterPack error: ENOENT: ... open '.../win-unpacked/undefined.exe'

Switched to packager.appInfo.productFilename -- an officially
documented, always-populated property (AppInfo class) that falls back
to the sanitized productName ("Slash") when no explicit
executableName override is configured, exactly our case. Works
identically on every platform, so getAppFileName is down to one
resolved name instead of three different (and, it turns out, not
equally reliable) expressions.

package-lock.json also had stale mattermost-desktop/6.2.0-develop.1
metadata predating the rebrand; npm install synced it to match
package.json.
mohlec merged commit e9ddce6512 into slash/main 2026-07-13 20:47:30 +00:00
mohlec deleted branch fix/afterpack-executable-name-undefined 2026-07-13 20:47:30 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
slash/slash-desktop!5
No description provided.