Skip to content

fix: compile on non-Unix targets by resolving config paths per platform - #18

Merged
rrrodzilla merged 4 commits into
mainfrom
fix/windows-xdg
Aug 19, 2026
Merged

rrrodzilla merged 4 commits into
mainfrom
fix/windows-xdg

Conversation

@rrrodzilla

Copy link
Copy Markdown
Contributor

Closes #17

What

  • xdg moves to [target.'cfg(unix)'.dependencies] — the crate's API is entirely cfg(unix)-gated upstream, so non-Unix builds no longer carry an unusable dependency.
  • Configuration discovery moves into a private common::config_paths module that states the platform rule once: the XDG search path under the acton prefix on Unix (unchanged, including $XDG_CONFIG_HOME and $XDG_CONFIG_DIRS), %APPDATA%\acton\<file> everywhere else. ActonConfig::load and IpcConfig::load both delegate to it.
  • "Could not determine where to search" is now distinguished from "searched, found nothing" and logged as an error instead of "using defaults".
  • The ipc feature is built on Unix domain sockets; enabling it off Unix now fails with a single compile_error! naming the fix instead of a wall of unresolved-import errors.
  • CI gains a windows-latest job (default-features build + test, no-default-features check).

Verification

  • clippy -D warnings clean: default, --no-default-features, --features ipc, --all-features
  • cargo nextest run: 465 / 652 / 466 passed across default, ipc-messagepack, and no-default-features gates
  • cargo check clean for x86_64-pc-windows-msvc and aarch64-apple-darwin; --features ipc on Windows produces exactly the intended compile_error!
  • The non-Unix lookup takes its root as a parameter so the %APPDATA% layout rule is unit-tested on the Linux host; only the three-line env read is platform-exclusive

Version: 9.2.0 (workspace bump + changelog included).

The xdg crate's entire API is cfg(unix)-gated upstream, so declaring it
unconditionally forces every non-Unix build to carry a dependency that
cannot be used. Move it to [target.'cfg(unix)'.dependencies].

Refs #17
`xdg` is declared under `[target.'cfg(unix)'.dependencies]`, but
`ActonConfig::load` and `IpcConfig::load` both named it unconditionally,
so any non-Unix build died with `cannot find module or crate xdg` before
reaching Acton code at all.

Configuration discovery moves into `common::config_paths`, which states
the platform rule once: the XDG search path under the `acton` prefix on
Unix, `%APPDATA%\acton\<file>` everywhere else. Both call sites delegate
to it and neither names a platform again. Unix resolution is byte-for-byte
unchanged, including `$XDG_CONFIG_HOME` and `$XDG_CONFIG_DIRS`.

The lookup returns `Result<Option<PathBuf>, ConfigLocationError>` so that
"could not determine where to search" is distinguishable from "searched,
found nothing"; the former is now logged as an error instead of being
reported as "using defaults".

The `ipc` feature is built on Unix domain sockets and never could have
worked off Unix, so it now refuses with a `compile_error!` naming the fix
rather than emitting a wall of unresolved-import errors.

The non-Unix lookup takes its root as a parameter, so its rule is
exercised by unit tests on the Unix CI host; only the three-line
`%APPDATA%` read is platform-exclusive. Verified against
x86_64-pc-windows-msvc, aarch64-apple-darwin, and x86_64-unknown-linux-gnu.
Locks in the Windows support added for #17: default-features build and
test plus a no-default-features check, mirroring the Ubuntu gates that
apply off Unix (the ipc gates stay Ubuntu-only since the feature is
Unix-only by design).
Sync the docs-site version constants with the workspace bump.
@rrrodzilla
rrrodzilla merged commit 379f044 into main Aug 19, 2026
2 checks passed
@rrrodzilla
rrrodzilla deleted the fix/windows-xdg branch August 19, 2026 22:37

This branch was previously deployed

1 inactive deployment
github-pages — 379f044b Deployed Aug 19, 2026 by rrrodzilla via deploy #16
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.

Windows build fails: xdg is an unconditional dependency but its API is Unix-only

1 participant