Repository navigation
fix: shorten project paths correctly on Windows - #83
Merged
Merged
Conversation
Every display site shortened a project path with
split('/').filter(Boolean).slice(-2), but projectPath comes from a session's
`cwd`, which is backslash-separated on Windows. The split finds no separator,
slice(-2) keeps the single element, and the label renders the entire path:
C:\Users\me\Documents\Vault\Projects\Early_App
instead of "Projects/Early_App". It affects the sidebar headers, the grid
view headings and cards, the new-session dialog, the settings viewer title,
and the plans/memory list — so on Windows nothing is actually shortened.
Adds shortProjectPath() to public/utils.js and routes the renderer sites
through it; main.js gets the same split locally, since it cannot share the
renderer helper.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The bug
Every place that shortens a project path for display does:
But
projectPathcomes from a session'scwd, which is backslash-separated on Windows. The split finds no separator,slice(-2)keeps the single element, and the label renders the entire path:So on Windows nothing is shortened anywhere — sidebar project headers, grid view headings and cards, the new-session dialog title, the settings viewer title, and the plans/memory list all show full absolute paths. In a narrow sidebar that means the meaningful part of the name is the part that gets truncated away.
The fix
Adds
shortProjectPath()topublic/utils.js— same logic, splitting on[\/]— and routes the six renderer sites through it.main.jsgets the same split locally, since it cannot share a renderer helper.No behaviour change on macOS or Linux: forward slashes still split exactly as before.
Verified
Ran the build on Windows against a real database. Sidebar labels before and after: