Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shorten length of temp directory name #2238

Closed
3 tasks done
splatteredbits opened this issue Aug 11, 2022 · 2 comments · Fixed by #2239
Closed
3 tasks done

Shorten length of temp directory name #2238

splatteredbits opened this issue Aug 11, 2022 · 2 comments · Fixed by #2239
Labels

Comments

@splatteredbits
Copy link
Contributor

Checklist

Summary of the feature request

As a Pester user on Windows, I sometimes get failures due to Windows' 260 character max path limitation. When Pester creates the temp directory for its test drive, it uses a Guid, which is 36 characters long, e.g. C:\Users\username\AppData\Local\Temp\19718499-6c05-4f67-bc4c-344f5c47c7bd.

Please shorten this to a four character directory name. This is what [IO.Path]::GetRandomFileName() uses for uniqueness. This saves 32 characters in the path.

How should it work?

Instead of using an entire GUID for the temp directory name, use just the first four characters. Change this (in TestDrive.ps1):

$Path = [IO.Path]::Combine($tempPath, ([Guid]::NewGuid()))

to

$Path = [IO.Path]::Combine($tempPath, ([Guid]::NewGuid().ToString().Substring(0, 4)))
@splatteredbits
Copy link
Contributor Author

PR incoming...

@splatteredbits
Copy link
Contributor Author

PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant