Skip to content

fix(config): fall back to USERPROFILE for config dir on Windows (DX-5667)#26

Merged
johnpmitsch merged 1 commit into
mainfrom
dx-5667-fix-windows-install-config-file-issue
Jun 11, 2026
Merged

fix(config): fall back to USERPROFILE for config dir on Windows (DX-5667)#26
johnpmitsch merged 1 commit into
mainfrom
dx-5667-fix-windows-install-config-file-issue

Conversation

@johnpmitsch

Copy link
Copy Markdown
Collaborator

Summary

  • On Windows, qn auth login failed with no config directory available on this platform: shells there set USERPROFILE rather than HOME, and the config-dir resolver only consulted XDG_CONFIG_HOME/HOME. The home directory now resolves from HOME first, then USERPROFILE, keeping the same ~/.config/qn/config.toml layout on every platform (%USERPROFILE%\.config\qn\config.toml on Windows). Unix behavior is unchanged.
  • The no-config-directory error is now actionable (names the env vars to set, or --config-file), and the README documents the Windows path.

Closes DX-5667

Test plan

  • cargo test — 199 tests pass, including 3 new resolver unit tests (USERPROFILE fallback, HOME precedence over USERPROFILE, all-unset returns None)
  • cargo clippy --all-targets -- -D warnings and cargo fmt --check clean
  • Real binary with a Windows-like env: env -u HOME -u XDG_CONFIG_HOME USERPROFILE=/tmp/qn-up ./target/debug/qn auth logout succeeds (previously errored); with no home vars at all, the new actionable error is shown

…667)

On Windows, shells set USERPROFILE rather than HOME, so config_dir()
returned None and 'qn auth login' failed with 'no config directory
available on this platform'. The home directory now resolves from HOME
first, then USERPROFILE, keeping the same ~/.config/qn/config.toml
layout on every platform. Unix behavior is unchanged.

Also makes the no-config-directory error actionable (name the env vars
to set, or --config-file) and documents the Windows path in the README.

Adds 3 unit tests for the resolver (USERPROFILE fallback, HOME
precedence, all-unset).
@johnpmitsch johnpmitsch merged commit b3daa74 into main Jun 11, 2026
13 checks passed
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.

2 participants