Maximus5 / ConEmu

Customizable Windows terminal with tabs, splits, quake-style, hotkeys and more
https://conemu.github.io/
BSD 3-Clause "New" or "Revised" License
8.5k stars 570 forks source link

In an MSYS2 shell, PasteExplorerPath both escapes the spaces and quotes the path, making the path invalid #2547

Open AmaiKinono opened 9 months ago

AmaiKinono commented 9 months ago

Versions

ConEmu build: 230724 stable x64 OS version: Windows 10 21H2 x64 Used shell version: MSYS2 ucrt shell

Problem description

When using PasteExplorerPath(1, 0) to paste a path with space in it, e.g., D:\name with space, conemu runs

$ cd "/d/name\ with\ space"

It both escapes the spaces and quotes the path, causing

bash: cd: /d/name\ with\ space: No such file or directory

Steps to reproduce

  1. Open a MSYS2 shell. My setup for the task is:
    set CHERE_INVOKING=1 & set MSYSTEM=UCRT64 & "%ConEmuDir%\msys64\usr\bin\bash.exe" --login -i -new_console:m:"":C:"%ConEmuDir%\msys64\ucrt64.ico"
  2. Set a macro to run PasteExplorerPath(1, 0)
  3. In explorer, visit a path with space in it.
  4. Call the macro.

Actual results

Conemu runs

$ cd "/d/name\ with\ space"

Expected results

Either

$ cd "/d/name with space"

or

$ cd /d/name\ with\ space

will do the work.