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

Check Windows version for LongPaths #3821

Merged
merged 5 commits into from
Dec 12, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions lib/diagnostic.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ function check_main_bucket {
}

function check_long_paths {
if (!(check_windows_version)) {
jfastnacht marked this conversation as resolved.
Show resolved Hide resolved
return $false
}
$key = Get-ItemProperty 'HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem' -ErrorAction SilentlyContinue -Name 'LongPathsEnabled'
if (!$key -or ($key.LongPathsEnabled -eq 0)) {
warn 'LongPaths support is not enabled.'
Expand All @@ -50,3 +53,14 @@ function check_long_paths {

return $true
}

function check_windows_version {
$key = Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion' -ErrorAction SilentlyContinue -Name 'ReleaseId'
if (!$key -or ($key.ReleaseId -lt 1607)) {
warn 'Your version of Windows does not support the LongPathsEnabled key.'

return $false
}

return $true
}