public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* cygwin_conv_path sometimes removes trailing slash
@ 2016-01-30 20:46 Ken Brown
  2016-01-31 22:25 ` Jan Nijtmans
  2016-02-14 19:08 ` Ken Brown
  0 siblings, 2 replies; 10+ messages in thread
From: Ken Brown @ 2016-01-30 20:46 UTC (permalink / raw)
  To: cygwin

I'm using cygwin_conv_path to convert Win32 paths to POSIX paths, and 
I'm puzzled by the conversion

   d:/ --> /cygdrive/d

without the trailing slash.  By contrast, we have

   d:/foo/ --> /cygdrive/d/foo/

Is the removal of the trailing slash in the first example a deliberate 
design decision?  I find it counter-intuitive.

My tests are essentially based on the example at the end of 
https://cygwin.com/cygwin-api/func-cygwin-conv-path.html:

#include <sys/cygwin.h>
#include <stdio.h>
#include <stdlib.h>

int
main ()
{
   wchar_t *win32 = L"d:/";
   ssize_t size;
   char *posix;
   size = cygwin_conv_path (CCP_WIN_W_TO_POSIX, win32, NULL, 0);
   if (size < 0)
     perror ("cygwin_conv_path");
   else
     {
       posix = (char *) malloc (size);
       if (cygwin_conv_path (CCP_WIN_W_TO_POSIX, win32, posix, size))
	perror ("cygwin_conv_path");
     }
   printf ("%s\n", posix);
}

Ken

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2016-02-15 15:26 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-30 20:46 cygwin_conv_path sometimes removes trailing slash Ken Brown
2016-01-31 22:25 ` Jan Nijtmans
2016-02-01 10:29   ` Henri
2016-02-01 10:38     ` Henri
2016-02-01 10:45     ` Ray Donnelly
2016-02-01 10:59       ` Henri
     [not found]   ` <CAOYw7ds-N=f+JCn-2rtFqOyahmA_M9mVNwv1CZH6__M-K7ht1A@mail.gmail.com>
2016-02-08 18:13     ` Corinna Vinschen
2016-02-11 16:50       ` Ray Donnelly
2016-02-14 19:08 ` Ken Brown
2016-02-15 15:26   ` Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).