MSYS/Cygwin paths (i.e. /c/dir or /cygdrive/c/dir)
Moderators: white, Hacker, petermad, Stefan2
MSYS/Cygwin paths (i.e. /c/dir or /cygdrive/c/dir)
[Feature request]
Is it possible to enable TC to accept paths of the form /c/dir and /cygwin/c/dir, like the ones used in MSYS2 and Cygwin?
Thank you.
Is it possible to enable TC to accept paths of the form /c/dir and /cygwin/c/dir, like the ones used in MSYS2 and Cygwin?
Thank you.
- ghisler(Author)
- Site Admin
- Posts: 48162
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Where should it accept them? When passed as parameters to TC?
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
-
- Power Member
- Posts: 872
- Joined: 2013-09-04, 14:07 UTC
Re: MSYS/Cygwin paths (i.e. /c/dir or /cygdrive/c/dir)
What are you trying to do, what has TC to do with (virtual/mapped) paths that exist only within the shell/execution environments of msys/cygwin?
Your question (feature request) sounds a bit like a XY problem.
Your question (feature request) sounds a bit like a XY problem.
It seems like it is mostly effective at the command line, e.g. cd /c/dir,ghisler(Author) wrote:Where should it accept them? When passed as parameters to TC?
or in a command parameters dialog.
My TC invocation is already in control (I can properly setup the startup environment).
Now, when I copy a path from a console and paste it into TC, here's when a transformation to Windows-formed path is required.
-
- Power Member
- Posts: 872
- Joined: 2013-09-04, 14:07 UTC
What if i have the following directories on my machine (with drive C: being the current drive in the active file panel):reinstein wrote:It seems like it is mostly effective at the command line, e.g. cd /c/dir,
or in a command parameters dialog.
C:\c
C:\c\dir
C:\dir
When i use TC with the feature you suggested, what will happen? Do i get a surprise gift from Mr. Ghisler?
Joking aside, perhaps this could be resolved by not using the cd command, but by having a special command for this, like ccd ("Cygwin CD") perhaps.
(Not sure if the expected usability value of this feature will justify the expected implementation effort; but that is Mr. Ghisler's call...)
Path expressions of the form '/c/dir' are of little use in Windows systems. Thus, one can let TC transform them into 'c:/dir' (you may have this configuration dependent, of course).elgonzo wrote:What if i have the following directories on my machine (with drive C: being the current drive in the active file panel):reinstein wrote:It seems like it is mostly effective at the command line, e.g. cd /c/dir,
or in a command parameters dialog.
C:\c
C:\c\dir
C:\dir
When i use TC with the feature you suggested, what will happen? Do i get a surprise gift from Mr. Ghisler?
Joking aside, perhaps this could be resolved by not using the cd command, but by having a special command for this, like ccd ("Cygwin CD") perhaps.
(Not sure if the expected usability value of this feature will justify the expected implementation effort; but that is Mr. Ghisler's call...)
Note that the purpose here is to allow consistency in the ecosystem TC is part of. A reasonable user would expect a 'cd' command to work properly in the described scenario given a sound transformation exists.
-
- Power Member
- Posts: 872
- Joined: 2013-09-04, 14:07 UTC
Says who?reinstein wrote:Path expressions of the form '/c/dir' are of little use in Windows systems.
Can you meaningfully describe that "sound transformation" you allude to?A reasonable user would expect a 'cd' command to work properly in the described scenario given a sound transformation exists.
Windows accepts both forward and back slashes, and path in form \a\b\x\c is pretty valid - it points to a dir relative to the root of the current drive. So if I'm in D:\A\B\C, cd \c\dir or cd /c/dir changes dir to D:\c\dir, it is so in TC and even in cmd.exe.reinstein wrote:Path expressions of the form '/c/dir' are of little use in Windows systems.
I think that you need a separate button or command that will call some script that will fix the path for TC, it is not a TC task to convert any kinds of strange paths into normal ones. If you have path copied into clipboard, perhaps it will be useful to have a script that gets it there. You can even override cd command in TC command line in order to enable any custom path preprocessing, TC allows it.
Overriding cd command:
1. Configuration, Misc, Redefine hotkeys, Alias: cd, press command selection button.
2. In command browser window locate usercmd.ini category and add new command named e.g. em_CustomCd, fill program path and parameters depending on scripting environment and use %A placeholder where you want to get path that was passed to cd command, I'll use just cmd.exe as an example:
3. Press OK and OK to close command editor and command browser, then click assign button (green checkmark) and OK to close Configuration window.
Now when you type cd something in TC command line, TC executes cmd.exe with parameters /c ""%%COMMANDER_EXE%%" /O /S /L="something"". So you can alter path in a script and pass it back to TC.
1. Configuration, Misc, Redefine hotkeys, Alias: cd, press command selection button.
2. In command browser window locate usercmd.ini category and add new command named e.g. em_CustomCd, fill program path and parameters depending on scripting environment and use %A placeholder where you want to get path that was passed to cd command, I'll use just cmd.exe as an example:
Code: Select all
Program: cmd.exe
Parameters: /c ""%%COMMANDER_EXE%%" /O /S /L="%Z%A""
Now when you type cd something in TC command line, TC executes cmd.exe with parameters /c ""%%COMMANDER_EXE%%" /O /S /L="something"". So you can alter path in a script and pass it back to TC.
Thanks!
Definitely worth a TC-wiki entry.
BTW, what does the %Z stand for?
Will also work in the following setup (skipping the shell invocation):
Program: %COMMANDER_EXE%
Parameters: /O /S /L="%Z%A"
For diagnosis, the following is useful:
Program: cmd.exe
Parameters: /c "echo "%%COMMANDER_EXE%%" /O /S /L="%Z%A" & pause"
Note, however, that this by itself will not replace the original 'cd' command, as relative paths will not work.
A translation script can fix that.
Anyways, it still looks that internal TC support for MSYS/Cygwin paths is still worth considering.
I have gone cold turkey off cmd as an interactive shell, replacing it with conemu/bash combination (via msys/Cygwin).
Before that, I have also spent quite a while working with TakeCommand, but bash/zfs/fish seem to have better prospects right now.
But then, one should be able to paste funny paths into TC...
BR
Definitely worth a TC-wiki entry.
BTW, what does the %Z stand for?
Will also work in the following setup (skipping the shell invocation):
Program: %COMMANDER_EXE%
Parameters: /O /S /L="%Z%A"
For diagnosis, the following is useful:
Program: cmd.exe
Parameters: /c "echo "%%COMMANDER_EXE%%" /O /S /L="%Z%A" & pause"
Note, however, that this by itself will not replace the original 'cd' command, as relative paths will not work.
A translation script can fix that.
Anyways, it still looks that internal TC support for MSYS/Cygwin paths is still worth considering.
I have gone cold turkey off cmd as an interactive shell, replacing it with conemu/bash combination (via msys/Cygwin).
Before that, I have also spent quite a while working with TakeCommand, but bash/zfs/fish seem to have better prospects right now.
But then, one should be able to paste funny paths into TC...
BR