@@ -52,7 +52,7 @@ $PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent
52
52
53
53
[string ] $CakeVersion = ' '
54
54
[string ] $DotNetVersion = ' '
55
- foreach ($line in Get-Content " $PSScriptRoot \ build.config" )
55
+ foreach ($line in Get-Content ( Join-Path $PSScriptRoot ' build.config' ) )
56
56
{
57
57
if ($line -like ' CAKE_VERSION=*' ) {
58
58
$CakeVersion = $line.SubString (13 )
@@ -117,16 +117,21 @@ if($FoundDotNetCliVersion -ne $DotNetVersion) {
117
117
}
118
118
119
119
if ($IsMacOS -or $IsLinux ) {
120
- (New-Object System.Net.WebClient).DownloadFile($DotNetUnixInstallerUri , " $InstallPath \dotnet-install.sh" );
121
- & bash $InstallPath \dotnet- install.sh -- version " $DotNetVersion " -- install-dir " $InstallPath " -- channel " $DotNetChannel " -- no- path
120
+ $ScriptPath = Join-Path $InstallPath ' dotnet-install.sh'
121
+ (New-Object System.Net.WebClient).DownloadFile($DotNetUnixInstallerUri , $ScriptPath );
122
+ & bash $ScriptPath -- version " $DotNetVersion " -- install-dir " $InstallPath " -- channel " $DotNetChannel " -- no- path
123
+ Remove-PathVariable " $InstallPath "
124
+ $env: PATH = " $ ( $InstallPath ) :$env: PATH "
122
125
}
123
126
else {
124
- ( New-Object System.Net.WebClient).DownloadFile( $DotNetInstallerUri , " $ InstallPath\ dotnet-install.ps1" );
125
- & $InstallPath \dotnet - install.ps1 - Channel $DotNetChannel - Version $DotNetVersion - InstallDir $InstallPath ;
126
- }
127
+ $ScriptPath = Join-Path $ InstallPath ' dotnet-install.ps1'
128
+ ( New-Object System.Net.WebClient).DownloadFile( $DotNetInstallerUri , $ScriptPath ) ;
129
+ & $ScriptPath - Channel $DotNetChannel - Version $DotNetVersion - InstallDir $InstallPath ;
127
130
128
131
Remove-PathVariable " $InstallPath "
129
132
$env: PATH = " $InstallPath ;$env: PATH "
133
+ }
134
+ $env: DOTNET_ROOT = $InstallPath
130
135
}
131
136
132
137
$env: DOTNET_SKIP_FIRST_TIME_EXPERIENCE = 1
@@ -146,7 +151,8 @@ if ($CakeInstalledVersion -eq $CakeVersion) {
146
151
$CakeExePath = (Get-Command dotnet- cake).Source
147
152
}
148
153
else {
149
- $CakePath = Join-Path $ToolPath " .store\cake.tool\$CakeVersion "
154
+ $CakePath = [System.IO.Path ]::Combine($ToolPath , ' .store' , ' cake.tool' , $CakeVersion ) # Old PowerShell versions Join-Path only supports one child path
155
+
150
156
$CakeExePath = (Get-ChildItem - Path $ToolPath - Filter " dotnet-cake*" - File| ForEach-Object FullName | Select-Object - First 1 )
151
157
152
158
@@ -168,7 +174,7 @@ else {
168
174
}
169
175
170
176
# ###########################################################################
171
- # # RUN BUILD SCRIPT
177
+ # RUN BUILD SCRIPT
172
178
# ###########################################################################
173
179
174
180
# Build the argument list.
0 commit comments