This is the mail archive of the
cygwin
mailing list for the Cygwin project.
cygwin_conv_path sometimes removes trailing slash
- From: Ken Brown <kbrown at cornell dot edu>
- To: cygwin <cygwin at cygwin dot com>
- Date: Fri, 29 Jan 2016 22:21:25 -0500
- Subject: cygwin_conv_path sometimes removes trailing slash
- Authentication-results: sourceware.org; auth=none
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