* path.cc (vcygpath): Handle cygdrive prefix.

This commit is contained in:
Corinna Vinschen 2012-11-09 08:53:01 +00:00
parent 2af359986f
commit 41783b90a2
2 changed files with 16 additions and 4 deletions

View File

@ -1,3 +1,7 @@
2012-11-09 Corinna Vinschen <corinna@vinschen.de>
* path.cc (vcygpath): Handle cygdrive prefix.
2012-11-07 Corinna Vinschen <corinna@vinschen.de> 2012-11-07 Corinna Vinschen <corinna@vinschen.de>
* Makefile.in ($(MINGW_BINS)): Drop -B$(mingw_build)/ from build * Makefile.in ($(MINGW_BINS)): Drop -B$(mingw_build)/ from build

View File

@ -1,7 +1,7 @@
/* path.cc /* path.cc
Copyright 2001, 2002, 2003, 2005, 2006, 2007, 2008, 2009, 2010, Copyright 2001, 2002, 2003, 2005, 2006, 2007, 2008, 2009, 2010,
2011 Red Hat, Inc. 2011, 2012 Red Hat, Inc.
This file is part of Cygwin. This file is part of Cygwin.
@ -837,12 +837,15 @@ vcygpath (const char *cwd, const char *s, va_list v)
for (m = mount_table; m->posix; m++) for (m = mount_table; m->posix; m++)
{ {
if (m->flags & MOUNT_CYGDRIVE)
continue;
int n = strlen (m->posix); int n = strlen (m->posix);
if (n < max_len || !path_prefix_p (m->posix, path, n)) if (n < max_len || !path_prefix_p (m->posix, path, n))
continue; continue;
if ((m->flags & MOUNT_CYGDRIVE)
&& (strlen (path) < n + 2
|| path[n] != '/'
|| !isalpha (path[n + 1])
|| path[n + 2] != '/'))
continue;
max_len = n; max_len = n;
match = m; match = m;
} }
@ -852,6 +855,11 @@ vcygpath (const char *cwd, const char *s, va_list v)
native = strdup (path); native = strdup (path);
else if (max_len == (int) strlen (path)) else if (max_len == (int) strlen (path))
native = strdup (match->native); native = strdup (match->native);
else if (match->flags & MOUNT_CYGDRIVE)
{
char drive[3] = { path[max_len + 1], ':', '\0' };
native = concat (drive, path + max_len + 2, NULL);
}
else if (isslash (path[max_len])) else if (isslash (path[max_len]))
native = concat (match->native, path + max_len, NULL); native = concat (match->native, path + max_len, NULL);
else else