suzdraws / mintty

Automatically exported from code.google.com/p/mintty
0 stars 0 forks source link

Transform paths of dragged in files to posix filenames #143

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi...

First thanks for creating mintty. It is IMHO the best terminal environment
for cygwin. I use it day by day.

But there is one thing I find a bit inconvinient when using it. When I drag
in a file to the mintty window the path generated is always displayed as
windows path. It would be much better if it is transformed to a posix path.

I did take a look at the sourcecode and hacked myself the automatic
transformation to a posix path. Find attached my patch to winclip.c doing
this. If you like it you can directly use it or change it any way you like
to. It works for cygwin 1.5 and 1.7. It also slightly changes the quoting
behaviour of dragged in files. It only quotes the filename if at least one
space is present in it.

Thanks for creating mintty,

Roland

Original issue reported on code.google.com by rol...@onevision.com on 28 Oct 2009 at 9:11

Attachments:

GoogleCodeExporter commented 9 years ago
The reason for inserting files as Windows paths rather than POSIX names is that 
while
Cygwin programs generally work fine with Windows paths, native programs can't 
deal
with Cygwin paths.

Then again, mintty is intended primarily for running Cygwin stuff, and there are
problems with native programs anyway (issue 56). Needs pondering; perhaps an 
option
is needed. There's also the idea of a popup menu on drop (issue 21).

Original comment by andy.koppe on 28 Oct 2009 at 7:16

GoogleCodeExporter commented 9 years ago
Hmm, there's a problem here. The cygwin_create_path(CCP_WIN_W_TO_POSIX, ...) 
function 
translates the path to the charset active at the start of mintty, usually UTF-8 
(particularly if mintty is invoked from the start menu). Yet the path actually 
needs 
to be translated to the charset of the child process, which may well be 
different if 
the user has set something in the mintty options.

Not sure how to address this. Translate to POSIX path, switch to filesystem 
charset, 
convert to wide, switch back to child charset, convert back to multibyte? Not 
pretty. 
A CCP_WIN_W_TO_POSIX_W conversion would be nice.

Original comment by andy.koppe on 31 Jan 2010 at 7:19

GoogleCodeExporter commented 9 years ago
Implemented in r747 on trunk. The cygwin_internal(CW_INT_SETLOCALE) API that's 
being 
introduced in Cygwin 1.7.2 is used to ensure that the correct charset is used 
to 
translate the filenames.

I decided not to provide an option to go back to Windows format, for the moment 
away. 
Let's see whether anyone complains.

Original comment by andy.koppe on 12 Feb 2010 at 8:30

GoogleCodeExporter commented 9 years ago

Original comment by andy.koppe on 13 Feb 2010 at 4:19

GoogleCodeExporter commented 9 years ago
well, I for one would like that to be an option.
exactly for the reason suggested above by @andy.koppe

> while Cygwin programs generally work fine with Windows paths, native programs 
can't deal with Cygwin paths.

for example, I want to use the win32 python inside my cygwin bash using mintty, 
and that does not like cygwin's paths, so I have to translate them using 
cygpath.

Original comment by cosimo.l...@daltonmaag.com on 19 Feb 2015 at 12:29