Skip to content

fix(tui): support Windows and WSL UNC paths in file drag-and-drop - #6

Merged
RobertWsp merged 2 commits into
RobertWsp:devfrom
477174:fix/wsl-file-drag-and-drop
Mar 5, 2026
Merged

fix(tui): support Windows and WSL UNC paths in file drag-and-drop#6
RobertWsp merged 2 commits into
RobertWsp:devfrom
477174:fix/wsl-file-drag-and-drop

Conversation

@477174

@477174 477174 commented Mar 4, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #3

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Fixes file drag-and-drop when running OpenCode in WSL. Windows paths dropped from Explorer (C:\Users\...) and WSL UNC paths (\\wsl$\...) are now detected and converted to their Linux mount equivalents (/mnt/c/...). Also strips double quotes that Windows Terminal wraps around dropped paths.

No changes to behavior on native Linux/macOS — only activates when WSL is detected.

How did you verify your code works?

  • Dragged files from Windows Explorer into OpenCode running in WSL2 via Windows Terminal
  • Verified C:\Users\foo\file.txt converts to /mnt/c/Users/foo/file.txt and attaches correctly
  • Verified native Linux paths still work as before
  • Build passes (bun run build), typecheck passes

Screenshots / recordings

N/A (terminal-based interaction)

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

477174 and others added 2 commits March 2, 2026 17:32
When running opencode in WSL, dragging files from Windows Explorer
pastes Windows-style paths (C:\Users\...) or WSL UNC paths
(\\wsl$\distro\...) which were not recognized by the paste handler.

- Add isWindowsPath/isFilePath/resolveDroppedPath helpers for
  platform-aware path detection and conversion
- Update all path detection guards in onPaste to accept Windows paths
- Convert drive-letter paths to /mnt/<drive>/... on WSL
- Convert \\wsl$/\\wsl.localhost UNC paths to native WSL paths
- Strip double quotes from dropped paths (Windows terminal behavior)
- Pass-through on native Windows and other platforms (no behavior change)

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
…acking

Writes active session ID to /tmp/opencode-session/<pid> on route
navigate and on init, enabling a custom tmux-resurrect save strategy
to capture the correct 'opencode -s <sessionID>' command even when
opencode was started without the -s flag.
@RobertWsp
RobertWsp merged commit 787a22b into RobertWsp:dev Mar 5, 2026
2 checks passed
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.

File drag-and-drop doesn't work on WSL (Windows paths not recognized)

2 participants