mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 06:50:54 +07:00
[platform] making the Defender configuration script resilient to missing excluded directories (IDEA-333056)
GitOrigin-RevId: e1d3c4813f65c88f08357bf6d0c0e1df7e502336
This commit is contained in:
committed by
intellij-monorepo-bot
parent
08e03cfc28
commit
a49624747f
@@ -18,14 +18,16 @@ try {
|
||||
# returns `$true` when a path is already covered by the exclusion list
|
||||
function Test-Excluded ([string] $path, [string[]] $exclusions) {
|
||||
foreach ($exclusion in $exclusions) {
|
||||
$expanded = [System.Environment]::ExpandEnvironmentVariables($exclusion)
|
||||
$resolvedPaths = Resolve-Path -Path $expanded
|
||||
foreach ($resolved in $resolvedPaths) {
|
||||
$resolvedStr = $resolved.ProviderPath.ToString()
|
||||
if ([cultureinfo]::InvariantCulture.CompareInfo.IsPrefix($path, $resolvedStr, @("IgnoreCase"))) {
|
||||
return $true
|
||||
try {
|
||||
$expanded = [System.Environment]::ExpandEnvironmentVariables($exclusion)
|
||||
$resolvedPaths = Resolve-Path -Path $expanded -ErrorAction Stop
|
||||
foreach ($resolved in $resolvedPaths) {
|
||||
$resolvedStr = $resolved.ProviderPath.ToString()
|
||||
if ([cultureinfo]::InvariantCulture.CompareInfo.IsPrefix($path, $resolvedStr, @("IgnoreCase"))) {
|
||||
return $true
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch [System.Management.Automation.ItemNotFoundException] { }
|
||||
}
|
||||
|
||||
return $false
|
||||
|
||||
Reference in New Issue
Block a user