Skip to main content

encode_project_path

Function encode_project_path 

Source
pub fn encode_project_path(project_path: &str) -> String
Expand description

Encode a project path the same way Claude Code does.

Windows: S:\Loom -> S--Loom, C:\Users\Seven\foo -> C--Users-Seven-foo macOS/Linux: /Users/seven/Loom -> -Users-seven-Loom, /home/alice/proj -> -home-alice-proj

The transform collapses any leading path separator(s) into a single leading dash, which is how Claude Code writes ~/.claude/projects/ directory names on Unix. Verified against ccusage’s decoder (see GitHub issue anthropics/claude-code#19972 for the path-encoding discussion).