Skip to content

Commit e1d7c70

Browse files
authored
Merge pull request #83546 from Steelskin/fabrice/utils-build-ps1-ps-core
utils: Make build.ps1 work with PowerShell Core
2 parents 7a500a6 + 347e5f4 commit e1d7c70

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

utils/build.ps1

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1678,8 +1678,10 @@ function Build-CMakeProject {
16781678

16791679
$ArgWithForwardSlashes = $Arg.Replace("\", "/")
16801680
if ($ArgWithForwardSlashes.Contains(" ")) {
1681-
# Quote and escape the quote so it makes it through
1682-
$Value += "\""$ArgWithForwardSlashes\"""
1681+
# Escape the quote so it makes it through. PowerShell 5 and Core
1682+
# handle quotes differently, so we need to check the version.
1683+
$quote = if ($PSEdition -eq "Core") { '"' } else { '\"' }
1684+
$Value += "$quote$ArgWithForwardSlashes$quote"
16831685
} else {
16841686
$Value += $ArgWithForwardSlashes
16851687
}

0 commit comments

Comments
 (0)