Skip to content

Conversation

@hhwjsw711
Copy link

Problem

On Windows, the plugin incorrectly creates a ~ directory in the project folder instead of using the user's home directory. This is because process.env.HOME is undefined on Windows.

Solution

Replace process.env.HOME || "~" with os.homedir() for cross-platform compatibility.

Changes

  • Added import * as os from "os" to src/cli.ts
  • Replaced 3 occurrences of process.env.HOME || "~" with os.homedir()
    • Line 469: setup command
    • Line 547: verify command
    • Line 652: SESSION_STATE_FILE constant

Testing

  • ✅ Builds successfully with TypeScript
  • ✅ Session state file now created in correct location on Windows (C:\Users\<username>\.config\claude-code-sync\)
  • ✅ No more ~ folder in project directories
  • ✅ Cross-platform compatibility maintained (works on Unix/Mac as well)
  • ✅ Consistent with existing pattern in src/index.ts:331

Related Issue

Fixes the Windows path issue where session state file was created in project directory instead of user home directory.

…bility

On Windows, process.env.HOME is undefined, causing the plugin to create
a literal '~' directory in the project folder instead of using the user's
home directory.

This commit replaces all occurrences of 'process.env.HOME || "~"' with
'os.homedir()' for proper cross-platform path resolution.

Changes:
- Added 'import * as os from "os"' to src/cli.ts
- Fixed 3 path.join() calls to use os.homedir()
  - setup command (line 469)
  - verify command (line 547)
  - SESSION_STATE_FILE constant (line 652)

Fixes Windows path issue where session state file was created in project
directory instead of user home directory.
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