Skip to content

Conversation

@ecielam
Copy link

@ecielam ecielam commented Jan 17, 2026

Summary

ActivityParser.ts hardcodes macOS-specific path pattern -Users-${USERNAME}--claude for the Claude Code projects directory. This fails on Linux systems where home directories are under /home/ instead of /Users/.

This is the same issue fixed in #[SessionHarvester PR number] for SessionHarvester.ts.

Changes

+import * as os from "os";

-const USERNAME = process.env.USER || require("os").userInfo().username;
-const PROJECTS_DIR = path.join(CLAUDE_DIR, "projects", `-Users-${USERNAME}--claude`);
+const USERNAME = process.env.USER || os.userInfo().username;
+// Cross-platform support: macOS uses /Users/, Linux uses /home/
+const PATH_PREFIX = os.platform() === "darwin" ? "Users" : "home";
+const PROJECTS_DIR = path.join(CLAUDE_DIR, "projects", `-${PATH_PREFIX}-${USERNAME}--claude`);

Testing

Linux (Ubuntu 24.04):

  • Path correctly resolves to -home-username--claude

macOS (expected):

  • Path resolves to -Users-username--claude (unchanged behavior)

Checklist

  • Tested on Linux
  • Maintains backward compatibility with macOS
  • No new dependencies (uses built-in os module)
  • Consistent with SessionHarvester fix pattern

Problem:
ActivityParser.ts hardcoded macOS-specific path pattern `-Users-${USERNAME}--claude`
for the Claude Code projects directory. This fails on Linux systems where the
home directory is `/home/` instead of `/Users/`.

Solution:
- Import `os` module for platform detection
- Use `os.platform()` to detect macOS ("darwin") vs Linux
- Dynamically construct PATH_PREFIX: "Users" on macOS, "home" on Linux
- Replace `require("os")` with proper `os` import for consistency

This is the same fix pattern applied to SessionHarvester.ts.

Tested on:
- Linux (Ubuntu): Correctly resolves to `-home-username--claude`
- Expected macOS behavior: `-Users-username--claude`

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copy link

@alessandro-estate-guru alessandro-estate-guru left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While you're in here, maybe just add windows support as well? If you add this, I'd do this in a switch instead of ternary to make it more legible.

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