Gunnar, You're right, this is a problem. Cygwin should be able to handle windows short form of directory names just as well as the long ones... For some reason it doesn't ('cd /cygdrive/c/PROGRA~1' results in "cd: /cygdrive/c/PROGRA~1: No such file or directory"). This is happening in most shells (sh, bash, tcsh), so I'm assuming it's a 'chdir()' problem. This only seems to happen if "check_case:strict" is part of $CYGWIN. Passing a short windows filename to other programs, e.g., vi, also fails with check_case:strict and succeeds with check_case:relaxed/adjust.
I used a pair of short programs to test chdir(): cdtest.c and cdtestnative.c. cdtest.c called chdir(), and cdtestnative.c called SetCurrentDirectory(), which chdir() uses internally. Both "cdtest 'c:\Program Files'" and "cdtestnative 'c:\Program Files'" succeeded. "cdtest 'c:\PROGRA~1'" failed, whereas "cdtestnative 'c:\PROGRA~1'" succeeded. I'm attaching both programs, and the strace output for three runs of cdtest: "cdtest 'c:\Program Files'" (cdtest_ProgramFiles.strace), "cdtest 'c:\PROGRA~1'" (cdtest_PROGRA~1.strace), and "cdtest 'c:\PROGRA~1'" with check_case:adjust in effect (cdtest_PROGRA~1_adjust.strace). >From the output, it looks like conv_to_win32_path() is not behaving correctly with short names. Can someone check on this? Igor On Wed, 25 Sep 2002, [iso-8859-1] Gunnar Boström wrote: > This works fine except that I get the windows short form of the > directories in the CFH variable. > I've tried filtering through cygpath but no luck. > Any suggestion? > > :-? > > > -----Original Message----- > > From: Frantisek Dufka [mailto:[EMAIL PROTECTED]] > > Sent: den 18 september 2002 10:56 > > To: [EMAIL PROTECTED] > > Subject: Re: Open bash at the current explorer directory? > > > > I don't know how to do it without using .bashrc, but this > > works for me (current cygwin, NT 4.0) > > > > Registry key contains: > > > > D:\cygwin\bin\rxvt.exe -sb -sr -sl 16384 -fn fixedsys -fg > > gray -bg black -e /bin/env CFH="%1" /bin/bash --login > > > > .bashrc contains > > > > if [ "$CFH" != "" ] ; then > > cd "$CFH" > > unset CFH > > fi > > > > No temporary files, bash.exe or .bash_profile is not executed twice. > > Also looks like cygpath -u is not needed, DOS paths seem to > > work in cd command. > > > > Frantisek > > > > ------------------------------------- > > * John Daniel Doucette <[EMAIL PROTECTED]> [13-09-02 15:23]: > > > I am using Win2000 Pro, SP3. Is there a way to invoke an interactive bash > > > shell at a particular directory, without using a .bashrc or similar file? > > > I.e. on the command lie alone? The --login and -c options appear to be > > > mutually exclusive. I would like to be able browse quickly to a directory > > > with explorer, option/right click on the directory, then select a custom > > > "open with cygwin" option, and have the bash shell open at that > > > directory. Has anyone tried this? > > > > Read this from the archive. > > http://www.cygwin.com/ml/cygwin/2002-05/msg01648.html > > > > HTH > > Jens -- http://cs.nyu.edu/~pechtcha/ |\ _,,,---,,_ [EMAIL PROTECTED] ZZZzz /,`.-'`' -. ;-;;,_ [EMAIL PROTECTED] |,4- ) )-,_. ,\ ( `'-' Igor Pechtchanski '---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow! "Water molecules expand as they grow warmer" (C) Popular Science, Oct'02, p.51
#include <stdio.h> int main(int ac, char *av[]) { char *dir = (ac<2)?"c:\\":av[1]; char buf[80]; int res = chdir(dir); printf("Current dir: %s\n", getcwd(buf, 80)); return res; }
#include <stdio.h> #include <windows.h> int main(int ac, char *av[]) { char *dir = (ac<2)?"c:\\":av[1]; char buf[80]; int res = SetCurrentDirectory(dir); int res1 = GetCurrentDirectory(80, buf); printf("Current dir: %s\n", buf); return res; }
cdtest_ProgramFiles.strace.bz2
Description: Binary data
cdtest_PROGRA~1.strace.bz2
Description: Binary data
cdtest_PROGRA~1_adjust.strace.bz2
Description: Binary data
-- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/