fix(explorer): keep verbatim Windows roots valid when listing and showing paths

Merged
GN
3d ago
+70-40

Summary

  • On Windows, the project registry stores project folders in the long-path form \?\D:\.... The explorer listing turned that into /?/D:/..., which Windows rejects with os error 123. Expanding a folder or opening a file from the explorer under such a project failed. The footer also showed //?/D:/....
  • The listing now joins child paths without collapsing //, and the footer drops the long-path prefix when it shows the path.

Related Issue

No issue. Found while testing the canvas work in #1369. It is a separate problem in shared code, so it gets its own PR.

Type of Change

  • fix: bug fix

What Changed

  • tauri-filesystem-api.ts: join dir/name without the global // collapse.
  • use-cwd.ts: formatPath strips the verbatim prefix, including verbatim UNC.
  • use-cwd.test.ts now tests the real formatPath instead of a pasted copy.

How It Was Tested

  • bun run typecheck
  • 8 new tests failed before the fix and pass after it. 145 pass across the touched test files.
  • Real Windows desktop app with a \?\ project root. Before the fix, a subfolder did not expand and a file did not open. After it, both work and the footer reads D:/....

Checklist

  • PR title follows the conventional commit format
  • Explained why no issue exists
  • Added tests
  • No unrelated modifications
  • Read AGENTS.md
  • A human reviewed the complete diff before submission

Note: bun run ci on dev currently fails on formatting in apply-color-theme.ts and editor-store.ts. This PR does not touch them. #1369 carries that formatting fix.

🤖 Generated with Claude Code


Summary by cubic

Fixes the explorer on Windows for project folders whose roots are stored in verbatim long-path form (\?\D:\...). Listing previously turned the root into /?/D:/..., which Windows rejects with error 123, so expanding subfolders and opening files failed; the footer also displayed the raw prefix. Child paths now keep the // that Windows requires, and the footer strips the verbatim prefix for display.