Skip to content

fix(windows): resolve Claude config without environment home - #278

Merged
jacob-bd merged 1 commit into
jacob-bd:mainfrom
Sanity-Cloud:upstream/windows-home-fallback-20260805
Aug 5, 2026
Merged

fix(windows): resolve Claude config without environment home#278
jacob-bd merged 1 commit into
jacob-bd:mainfrom
Sanity-Cloud:upstream/windows-home-fallback-20260805

Conversation

@insane66613

Copy link
Copy Markdown
Contributor

Summary

  • add a Windows profile-directory fallback for environments where Path.home() cannot resolve
  • use the Windows shell profile path before constructing AppData\Roaming and AppData\Local fallbacks
  • preserve the existing environment-variable and Path.home() behavior when those sources are available

Problem

_claude_desktop_candidate_paths() currently calls Path.home() after APPDATA / LOCALAPPDATA are absent. On Windows, clearing the environment can make Path.home() raise RuntimeError: Could not determine home directory, including in the existing test_windows_path_falls_back_when_appdata_is_missing case.

Implementation

The fallback order is:

  1. Path.home()
  2. SHGetFolderPathW(CSIDL_PROFILE)
  3. SYSTEMDRIVE\Users\<os.getlogin()>

The helper raises the original Path.home() error when no reliable Windows profile path can be resolved.

Validation

  • uv run ruff check .
  • uv run ruff format --check .
  • uv run pytest tests/cli/test_setup_claude_desktop.py -q — 39 passed
  • full upstream-first integration stack on Windows — 1,318 passed, 39 skipped

Manual Windows reproduction: with home-related environment variables cleared, Claude Desktop config-path resolution returns a profile-based path instead of raising from Path.home().

No new dependencies.

@jacob-bd
jacob-bd merged commit 00c48b0 into jacob-bd:main Aug 5, 2026
3 checks passed
jacob-bd added a commit that referenced this pull request Aug 5, 2026
Recover from empty port-map Chrome/Edge orphans during nlm login (#277),
ship the Sanity-Cloud PRs (#278#283), and align package version metadata.

Co-authored-by: Cursor <cursoragent@cursor.com>
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