Skip to content

Conversation

@jeffbi
Copy link
Contributor

@jeffbi jeffbi commented Jun 7, 2017

Fixes #3891

When calling Windows native API to determine if an item exists, ensure the path is prepended with \\?\ to allow for paths > 260 characters.

When calling Windows native API to determine if an item exists,
ensure the path is prepended with "\\?\" to allow for long paths.
internal static extern int GetFileAttributes(string lpFileName);
private static string EnsureLongPathPrefix(string path)
{
if (!path.StartsWith(@"\\?\", StringComparison.Ordinal))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we skip adding the prefix when the path is short?

Always adding the prefix will create a lot of garbage I think.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Backport-5.1-Consider Consider to backport to Windows PowerShell 5.1 due to impact

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants