Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2011-02-02 12:59:10 +0300
committerCorinna Vinschen <corinna@vinschen.de>2011-02-02 12:59:10 +0300
commitcecc445d5c099e4785dd3da444458b6838325209 (patch)
tree268d9c6ec81634e5d47ad4116da886e4a59fff5b /winsup/cygwin/path.cc
parent0e126cb141e7c9d3d8d8704bc31b3470d46acd0b (diff)
* path.cc (conv_path_list): Remove enclosing quotes and trailing
backslashes from Win32 environment path lists.
Diffstat (limited to 'winsup/cygwin/path.cc')
-rw-r--r--winsup/cygwin/path.cc24
1 files changed, 21 insertions, 3 deletions
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index cb38a25f1..e4075410f 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -1351,17 +1351,35 @@ conv_path_list (const char *src, char *dst, size_t size, int to_posix)
bool saw_empty = false;
do
{
- char *s = strccpy (srcbuf, &src, src_delim);
- size_t len = s - srcbuf;
+ char *srcpath = srcbuf;
+ char *s = strccpy (srcpath, &src, src_delim);
+ size_t len = s - srcpath;
if (len >= NT_MAX_PATH)
{
err = ENAMETOOLONG;
break;
}
+ /* Paths in Win32 path lists in the environment (%Path%), are often
+ enclosed in quotes (usually paths with spaces). Trailing backslashes
+ are common, too. Remove them. */
+ if (to_posix == ENV_CVT && len)
+ {
+ if (*srcpath == '"')
+ {
+ ++srcpath;
+ *--s = '\0';
+ len -= 2;
+ }
+ while (len && s[-1] == '\\')
+ {
+ *--s = '\0';
+ --len;
+ }
+ }
if (len)
{
++d;
- err = cygwin_conv_path (conv_fn, srcbuf, d, size - (d - dst));
+ err = cygwin_conv_path (conv_fn, srcpath, d, size - (d - dst));
}
else if (!to_posix)
{