Skip to content

extra_applications(:host): guard wx_app_on_disk?/0 against nil - #83

Merged
dominicletz merged 1 commit into
mainfrom
fix/wx-app-on-disk-nil-guard
Aug 8, 2026
Merged

extra_applications(:host): guard wx_app_on_disk?/0 against nil#83
dominicletz merged 1 commit into
mainfrom
fix/wx-app-on-disk-nil-guard

Conversation

@dominicletz

Copy link
Copy Markdown
Collaborator

extra_applications(:host): guard wx_app_on_disk?/0 against nil

Enum.find/2 returns nil when no matching directory is found, but the
with clause used an unbound pattern that silently matched nil and let
the body run with wx_dir = nil, crashing Path.join/1 with:

** (FunctionClauseError) no function clause matching in
IO.chardata_to_string/1 (called with nil)
(elixir 1.16.3) lib/path.ex:672: Path.do_join/3
lib/desktop/mix.exs: Desktop.MixProject.wx_app_on_disk?/0

Reproducible on any OTP build configured --without-wx (e.g. the
elixir-desktop/ddrive macOS installer CI): the OTP root's lib/
directory has no wx-* entry, Enum.find returns nil, and the probe
crashes instead of returning false.

Add an is_binary(wx_dir) guard so the with chain falls through to
the existing else _ -> false clause on a no-wx host, and document
the pitfall in the comment block above extra_applications/1.

Fixes the regression introduced in #82 and unblocks downstream PRs
that bump the desktop dep to include the fs probe.

Enum.find/2 returns nil when no matching directory is found, but the
with clause used an unbound pattern that silently matched nil and let
the body run with wx_dir = nil, crashing Path.join/1 with:

  ** (FunctionClauseError) no function clause matching in
     IO.chardata_to_string/1 (called with nil)
     (elixir 1.16.3) lib/path.ex:672: Path.do_join/3
     lib/desktop/mix.exs: Desktop.MixProject.wx_app_on_disk?/0

Reproducible on any OTP build configured --without-wx (e.g. the
elixir-desktop/ddrive macOS installer CI): the OTP root's lib/
directory has no wx-* entry, Enum.find returns nil, and the probe
crashes instead of returning false.

Add an is_binary(wx_dir) guard so the with chain falls through to
the existing `else _ -> false` clause on a no-wx host, and document
the pitfall in the comment block above extra_applications/1.

Fixes the regression introduced in #82 and unblocks downstream PRs
that bump the desktop dep to include the fs probe.

Co-authored-by: Cursor <cursoragent@cursor.com>
@dominicletz
dominicletz merged commit bcd377a into main Aug 8, 2026
2 checks passed
@dominicletz
dominicletz deleted the fix/wx-app-on-disk-nil-guard branch August 8, 2026 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant