* cygpath.cc (do_pathconv): when -p option is given, generate wide

path without long path prefixing.
	* wide_path.h (wide_path::wide_path): Allow extra bool parameter to
	specify whether or not performing Windows long path prefixing.
This commit is contained in:
Corinna Vinschen
2013-06-26 13:10:35 +00:00
parent bce06a5f2f
commit 733b554b20
3 changed files with 12 additions and 5 deletions

View File

@@ -2,7 +2,7 @@
to wchar_t Win32 path including long path prefix if
necessary.
Copyright 2009, 2011 Red Hat, Inc.
Copyright 2009, 2011, 2013 Red Hat, Inc.
This file is part of Cygwin.
@@ -19,12 +19,12 @@ class wide_path
public:
wide_path () : wp (NULL) {}
wide_path (const char *mb_path)
wide_path (const char *mb_path, bool do_prefix = true)
{
int len = mbstowcs (NULL, mb_path, 0) + 1;
wp = (wchar_t *) malloc ((len + 6) * sizeof (wchar_t));
wchar_t *wp_p = wp;
if (len >= MAX_PATH && strncmp (mb_path, "\\\\?\\", 4) != 0)
if (do_prefix && len >= MAX_PATH && strncmp (mb_path, "\\\\?\\", 4) != 0)
{
wcscpy (wp_p, L"\\\\?\\");
wp_p += 4;