kerol2r20 / Windows-terminal-context-menu

📃 This is a simple script to add right click context menu for your best Windows terminal ❤
417 stars 37 forks source link

Directory Paths not working for Cygwin #27

Open kalaschnik opened 4 years ago

kalaschnik commented 4 years ago

Cygwin maps Linux POSIX paths to Windows Path and prefixes the current path with /cygdrive/

That means, assume you are in this folder: C:\Users\Username\git\project the corresponding cygwin path would be /cygdrive/c/Users/Username/git/project

Could you prepend the /cygdrive/ if a users defines an id which contains cygwin in the commandline property. I’m not a Powershell scripter, so it woud take too much time for me.

kerol2r20 commented 4 years ago

One question is how to identify a profile is Cygwin environment? Because this profile is added by user, it's not easy to guarantee a fixed pattern.

kalaschnik commented 4 years ago

Either by checken the commandline property with a regular expression as cygwin by default has its own name included in the install directory (i.e., cygwin64 or cygwin32) see here:

Windows Terminal’s settings.json:

{
    "guid": "{07ece1cb-ff14-4179-a738-1781081fd8be}",
    "hidden": false,
    "name": "Cygwin",
    "icon": "C:/cygwin64/Cygwin-Terminal.ico",
    "commandline": "c:/cygwin64/Cygwin.bat",
    "startingDirectory": "/cygdrive/d",
    "backgroundImage": "%OneDrive%/.config/.assets/cygwin.png",
    "backgroundImageOpacity": 0.1
},

Or you could also allow a user to set a flag, in case the go crazy and change cygwin names to something different:

This project’s config.json:

"{07ece1cb-ff14-4179-a738-1781081fd8be}": {
    "icon": "cygwin.ico",
    "isCygwin": true
},

I think the latter option is safest.

kerol2r20 commented 4 years ago

These two way are good! Have you tried to open wt.exe with /cygdrive/c path?

I tried `wt.exe -p "Cygwin" -d /cygdrive/c/". But it did not worke.

kalaschnik commented 4 years ago

Same, it does not like the -d operation... hmm

kalaschnik commented 4 years ago

@rescenic Well, how does this solve anything regarding the issue (i.e., open a desired folder location using shell menu)?

rescenic commented 4 years ago

Yeah, doesn't work for Cygwin & MSYS2. My bad. It works for WSL, CMD, PowerShell. wsl

Akshay-akkay commented 4 years ago

Same issue is happening for Git Bash.