Skip to content

fix: keep default system tray icon when the custom icon copy fails#1303

Open
LuisMIguelFurlanettoSousa wants to merge 1 commit into
tw93:mainfrom
LuisMIguelFurlanettoSousa:fix/system-tray-icon-copy-order
Open

fix: keep default system tray icon when the custom icon copy fails#1303
LuisMIguelFurlanettoSousa wants to merge 1 commit into
tw93:mainfrom
LuisMIguelFurlanettoSousa:fix/system-tray-icon-copy-order

Conversation

@LuisMIguelFurlanettoSousa

Copy link
Copy Markdown

Closes #1302

What

mergeIcons set trayIconPath (→ system_tray_path) to the custom icon path before fsExtra.copy, and discarded the result of fsExtra.pathExists. A missing source or a failing copy left the config pointing at a png/<name> file that was never written, while the catch told the user the default "will remain unchanged".

Change

  • Use the previously-dead fsExtra.pathExists check: a missing source now keeps the default with a clear "not found" message.
  • Assign trayIconPath only after a successful fsExtra.copy, so a failed copy genuinely keeps the default (the existing catch warning is now truthful).
  • dist/cli.js rebuilt.

Note on testing

mergeIcons is module-internal (not exported) and does file I/O, so it isn't unit-testable without a refactor; the change is a small, self-evident reordering plus using an already-present check. Verified by type-check + the full suite staying green.

Verify

pnpm run cli:build && npx vitest run

205 passed; pnpm run format:check clean.

mergeIcons assigned trayIconPath (-> system_tray_path) to the custom icon path
BEFORE running fsExtra.copy, and discarded the result of the fsExtra.pathExists
check. So a missing source or a failing copy left the config pointing at a
png/<name> file that was never written, while the catch told the user the
default 'will remain unchanged'. Use the existence check to keep the default
(with a clear 'not found' message) and assign trayIconPath only after the copy
succeeds, making the warning truthful.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant