[PR #11625] [MERGED] Automatically convert paths dropped on WSL instances #28666

Open
opened 2026-01-31 09:29:57 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/11625
Author: @petrsnm
Created: 10/27/2021
Status: ✅ Merged
Merged: 11/10/2021
Merged by: @undefined

Base: main ← Head: FixDragDropWslPath


📝 Commits (6)

  • 3e22379 When drag-n-drop filepath to WSL, fix the path so it's usable
  • e1a7f57 Update src/cascadia/TerminalControl/TermControl.cpp
  • a9d9cf0 allow "mnt" (default automount root for WSL2) as correctly spelled word
  • 58091e3 Handle //wsl$// paths that used for WSL on Windows 10
  • e2d1d82 Make the code format checker happy
  • 3ca1171 change files permission from 100755 to 100644

📊 Changes

6 files changed (+43 additions, -0 deletions)

View changed files

📝 .github/actions/spelling/allow/allow.txt (+1 -0)
📝 src/cascadia/TerminalControl/IControlSettings.idl (+1 -0)
📝 src/cascadia/TerminalControl/TermControl.cpp (+37 -0)
📝 src/cascadia/TerminalSettingsModel/TerminalSettings.cpp (+1 -0)
📝 src/cascadia/TerminalSettingsModel/TerminalSettings.h (+2 -0)
📝 src/cascadia/UnitTests_Control/MockControlSettings.h (+1 -0)

📄 Description

Drag and drop does not work for WSL because paths are pasted as windows
paths having incorrect path separator and path root. This PR adds code
to correct the path in TerminalControl before pasting to WSL terminals.

One problem with this approach is that it assumes the default WSL
automount root of "/mnt". It would be possible to add a setting like
"WslDragAndDropMountRoot"... but I decided it if someone wants to change
automount location it would be simple enough just to create the "/mnt"
symlink in WSL.

Validation

Couldn't find an obvious place to add a test. Manually tested
cut-n-paste from following paths:

  • "c:"
  • "c:\subdir"
  • "c:\subdir\subdir"
  • "\wsl.localhost<distro>"
  • \wsl.localhost<distro>\subdir"

Closes #331


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/microsoft/terminal/pull/11625 **Author:** [@petrsnm](https://github.com/petrsnm) **Created:** 10/27/2021 **Status:** ✅ Merged **Merged:** 11/10/2021 **Merged by:** [@undefined](undefined) **Base:** `main` ← **Head:** `FixDragDropWslPath` --- ### 📝 Commits (6) - [`3e22379`](https://github.com/microsoft/terminal/commit/3e22379a733c25672f82bd3a2b7f8d0e5004337b) When drag-n-drop filepath to WSL, fix the path so it's usable - [`e1a7f57`](https://github.com/microsoft/terminal/commit/e1a7f57c0b8150d4efb62b09fa2c1e6955c7879b) Update src/cascadia/TerminalControl/TermControl.cpp - [`a9d9cf0`](https://github.com/microsoft/terminal/commit/a9d9cf0ab4571ce334b2ba76fccee2d597631e5c) allow "mnt" (default automount root for WSL2) as correctly spelled word - [`58091e3`](https://github.com/microsoft/terminal/commit/58091e36381388739a3e35a0fb003741250c1f9b) Handle //wsl$/<distro>/ paths that used for WSL on Windows 10 - [`e2d1d82`](https://github.com/microsoft/terminal/commit/e2d1d82ac9fe31054dde71e95a53ea3598e1e550) Make the code format checker happy - [`3ca1171`](https://github.com/microsoft/terminal/commit/3ca11715fea09bd0c71d6e9db1f132b2f45be1c0) change files permission from 100755 to 100644 ### 📊 Changes **6 files changed** (+43 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `.github/actions/spelling/allow/allow.txt` (+1 -0) 📝 `src/cascadia/TerminalControl/IControlSettings.idl` (+1 -0) 📝 `src/cascadia/TerminalControl/TermControl.cpp` (+37 -0) 📝 `src/cascadia/TerminalSettingsModel/TerminalSettings.cpp` (+1 -0) 📝 `src/cascadia/TerminalSettingsModel/TerminalSettings.h` (+2 -0) 📝 `src/cascadia/UnitTests_Control/MockControlSettings.h` (+1 -0) </details> ### 📄 Description Drag and drop does not work for WSL because paths are pasted as windows paths having incorrect path separator and path root. This PR adds code to correct the path in TerminalControl before pasting to WSL terminals. One problem with this approach is that it assumes the default WSL automount root of "/mnt". It would be possible to add a setting like "WslDragAndDropMountRoot"... but I decided it if someone wants to change automount location it would be simple enough just to create the "/mnt" symlink in WSL. ## Validation Couldn't find an obvious place to add a test. Manually tested cut-n-paste from following paths: - "c:\" - "c:\subdir" - "c:\subdir\subdir" - "\\wsl.localhost\<distro>" - \\wsl.localhost\<distro>\subdir" Closes #331 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-31 09:29:57 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#28666