Skip to content

Windows: cross-platform home_dir lookup (#8, #13)#16

Merged
MasonStation merged 1 commit intomainfrom
windows-home-dir
Apr 22, 2026
Merged

Windows: cross-platform home_dir lookup (#8, #13)#16
MasonStation merged 1 commit intomainfrom
windows-home-dir

Conversation

@MasonStation
Copy link
Copy Markdown
Contributor

Second slice of #1 (Windows support) — Tier 1 (home dir).

Summary

Replaces direct reads of \$HOME with dirs::home_dir(), which resolves to \$HOME on Unix and %USERPROFILE% on Windows.

  • Vault fallback path (crates/phantom-vault/src/lib.rs:71-74) — keeps the existing ~/.phantom vault location on all OSes (behavior-preserving for existing Mac/Linux users; correct on Windows). /tmp fallback replaced with std::env::temp_dir() which resolves to %TEMP% on Windows.
  • Setup helper (crates/phantom-cli/src/commands/setup.rs:176-178) — used to locate ~/.cargo/bin/phantom-mcp.

Why no vault migration concern

The dirs_fallback() path is already $HOME/.phantom on Unix. dirs::home_dir() returns the same $HOME value on Unix. Existing vaults keep the same location.

Test plan

  • CI green on ubuntu-latest
  • CI green on macos-latest
  • CI green on windows-latest

Closes #8
Closes #13

Replaces direct reads of \$HOME (unset by default on Windows) with
dirs::home_dir(), which resolves to:
  - \$HOME on Unix
  - %USERPROFILE% on Windows

Vault fallback path preserves existing ~/.phantom location on every
OS; no migration needed for existing Mac/Linux users. /tmp fallback
replaced with std::env::temp_dir() which resolves to %TEMP% on
Windows.

Closes #8
Closes #13

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@MasonStation MasonStation merged commit 928748a into main Apr 22, 2026
4 checks passed
@MasonStation MasonStation deleted the windows-home-dir branch April 22, 2026 17:40
@MasonStation MasonStation mentioned this pull request Apr 22, 2026
14 tasks
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.

cli: use dirs::home_dir() instead of $HOME in setup vault: replace $HOME fallback with cross-platform home dir

1 participant