Skip to content

Commit

Permalink
Fix PS5.1-incompatible use of IsPathFullyQualified
Browse files Browse the repository at this point in the history
The Initialize-PSBuild function was not compatible with .NET Framework / PowerShell 5.1 due to the use of the System.IO.Path.IsPathFullyQualified method. I changed the function to check if the value of OutDir already started with BHProjectPath rather than testing if OutDir was a fully qualified path on it's own. This seems to have solved the issue and tests are passing.
  • Loading branch information
joshooaj committed Sep 21, 2021
1 parent 89f30c2 commit 312de56
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion PowerShellBuild/Public/Initialize-PSBuild.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function Initialize-PSBuild {
[switch]$UseBuildHelpers
)

if ([IO.Path]::IsPathFullyQualified($BuildEnvironment.Build.OutDir)) {
if ($BuildEnvironment.Build.OutDir.StartsWith($env:BHProjectPath, [System.StringComparison]::InvariantCultureIgnoreCase)) {
$BuildEnvironment.Build.ModuleOutDir = [IO.Path]::Combine($BuildEnvironment.Build.OutDir, $env:BHProjectName, $BuildEnvironment.General.ModuleVersion)
} else {
$BuildEnvironment.Build.ModuleOutDir = [IO.Path]::Combine($env:BHProjectPath, $BuildEnvironment.Build.OutDir, $env:BHProjectName, $BuildEnvironment.General.ModuleVersion)
Expand Down

0 comments on commit 312de56

Please sign in to comment.