Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Allow use of long paths#3960

Merged
lzybkr merged 2 commits into
PowerShell:masterPowerShell/PowerShell:masterfrom
jeffbi:item-exists-3891Copy head branch name to clipboard
Jun 8, 2017
Merged

Allow use of long paths#3960
lzybkr merged 2 commits into
PowerShell:masterPowerShell/PowerShell:masterfrom
jeffbi:item-exists-3891Copy head branch name to clipboard

Conversation

@jeffbi

@jeffbi jeffbi commented Jun 7, 2017

Copy link
Copy Markdown

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
Copy Markdown
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
Copy Markdown
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

Morty Proxy This is a proxified and sanitized view of the page, visit original site.