Skip to content

fix: strip Windows UNC path prefix for Bun compatibility#494

Merged
j4rviscmd merged 2 commits into
mainfrom
worktree-fix+windows-unc-path-bun
May 9, 2026
Merged

fix: strip Windows UNC path prefix for Bun compatibility#494
j4rviscmd merged 2 commits into
mainfrom
worktree-fix+windows-unc-path-bun

Conversation

@j4rviscmd
Copy link
Copy Markdown
Owner

Summary

  • Windows上でBunランタイムが \?\ UNCパスプレフィックスを処理できず、全ビルトイン拡張機能のアクティベーションが失敗していた問題を修正
  • dunce クレートを追加し、canonicalize() がUNCプレフィックスなしのパスを返すように変更
  • spawn_exthost.rsstrip_unc_prefix() ヘルパーを追加し、resource_dir()current_dir() の結果もクリーンアップ

Root cause

On Windows, std::fs::canonicalize() and Tauri's resource_dir() return paths with the \?\ extended-length path prefix. Node.js handles this transparently, but Bun does not — it treats the prefix as part of the filename, causing all built-in extensions to fail with Cannot find module '\?\E:\...\extension.js'.

Test plan

  • Windows上でアプリを起動し、ビルトイン拡張機能(Git, Emmet, JSON等)が正常にアクティベートされることを確認
  • vscode-neovimのカーソル移動が正常に動作することを確認
  • macOSでリグレッションがないことを確認

🤖 Generated with Claude Code

j4rviscmd and others added 2 commits May 9, 2026 22:35
On Windows, `std::fs::canonicalize()` and Tauri's `resource_dir()`
return paths with the `\?\` extended-length path prefix. Node.js
handles this transparently, but Bun does not — it treats the prefix
as part of the filename, causing module resolution failures in the
Extension Host.

This caused ALL built-in extensions (git, emmet, json-language-features,
typescript-language-features, etc.) to fail activation on Windows with
errors like: `Cannot find module '\?\E:\...\extension.js'`.

Fix:
- Add `dunce` crate which provides `canonicalize()` without the UNC prefix
- Replace `std::fs::canonicalize()` with `dunce::canonicalize()` in
  `resolve_extensions_dir()` (extensions.rs)
- Add `strip_unc_prefix()` helper and apply it to `resource_dir()` and
  `current_dir()` results in `resolve_app_root_and_resource_dir()`
  (spawn_exthost.rs)

On macOS/Linux, `dunce` is a thin wrapper around `std::fs` with no
behavioral change.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
@j4rviscmd j4rviscmd merged commit d65214d into main May 9, 2026
7 checks passed
@j4rviscmd j4rviscmd deleted the worktree-fix+windows-unc-path-bun branch May 9, 2026 14:39
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.

1 participant