fix add-project on Windows drive paths#37
Conversation
5 idle terminals with cursorBlink: true cause ~28% CPU from constant WebGL repaint cycles. With blink disabled, idle terminals drop to near-zero. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The folder-name regex only replaced / and _, so Windows paths like Q:\src\DevBox produced invalid mkdir targets under .claude/projects/. Add \ and : to the character class across all 10 occurrences. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
I assume this was tested? I have no way to verify |
|
Hey @navedr — thanks for catching this and digging in on the Windows side. I picked up the same thread from a different angle in #41 (issue #38, duplicate sidebar entries on macOS for paths with spaces/dots) and ended up reverse-engineering the Claude CLI's actual folder-naming algorithm: projectPath.replace(/[^a-zA-Z0-9]/g, '-')
// + 200-char cap with a deterministic hash suffix on overflowThis fully covers the #41 also routes all 10 occurrences through a shared Mind if we close this in favor of #41? Full credit to you for surfacing the Windows half of the bug — happy to call that out in the PR description if useful. — Claude (Opus 4.7), on behalf of @abassiri |
…sidebar entries (#41) Switchboard's folder-name regex only replaced `/` and `_`, while the Claude CLI replaces every non-alphanumeric character (and applies a 200-char cap with a hash suffix on overflow). For project paths containing spaces, dots, backslashes, colons, etc., the two sides produced different folder names under ~/.claude/projects/, surfacing as undismissable duplicate projects in the sidebar. - Add encode-project-path.js mirroring the CLI's algorithm exactly (reverse-engineered from claude 2.1.126: /[^a-zA-Z0-9]/g, 200-char cap, (h<<5)-h+c|0 hash suffix on overflow). Deterministic and pure. - Mirror the encoder in public/utils.js for the renderer. - Route all 10 call sites through encodeProjectPath(). - Fix session-cache.js phantom-project bug: only insert a project entry after the archive filter passes, so folders whose sessions are all archived don't appear as empty undismissable projects in the sidebar. Fixes #38. Supersedes #37 (also covers Windows drive paths). Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
No problem. But please take a look at this #39. |
Summary
Q:\src\DevBoxwere being passed throughpath.join(PROJECTS_DIR, folder)with:and\intact, producing invalid paths likeC:\Users\...\.claude\projects\Q:\src\DevBoxreplace(/[/_]/g, '-')only handled/and_— now includes\and:to handle Windows drive pathsmain.js,session-cache.js,schedule-ipc.js,public/app.js,public/dialogs.jsTest plan
Q:\src\DevBox) — should succeed without ENOENT.claude/projects/uses-delimiters (e.g.-Q-src-DevBox)/was already in the character class)🤖 Generated with Claude Code