Skip to content

fix: shorten project paths correctly on Windows - #83

Merged
abasiri merged 1 commit into
doctly:mainfrom
Davidb-2107:fix/windows-project-path
Aug 1, 2026
Merged

abasiri merged 1 commit into
doctly:mainfrom
Davidb-2107:fix/windows-project-path

Conversation

@Davidb-2107

Copy link
Copy Markdown
Contributor

The bug

Every place that shortens a project path for display does:

projectPath.split('/').filter(Boolean).slice(-2).join('/')

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     (rendered)
Projects/Early_App                                  (intended)

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() to public/utils.js — same logic, splitting on [\/] — and routes the six renderer sites through it. main.js gets 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:

before   C:\Users\dbele\Documents\ObsidianVault\Wiki_Claude\Projects\Switchboard
after    Projects/Switchboard
         TikTok/Neon_Psycho
         Projects/Early_App
         ObsidianVault/Wiki_Claude

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>
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