Skip to content
This repository was archived by the owner on Mar 11, 2020. It is now read-only.

Commit 97f75f8

Browse files
committed
Fix target path for file copies
Signed-off-by: Elton Stoneman <elton@sixeyed.com>
1 parent 81b9ab2 commit 97f75f8

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

Functions/Private/Artifacts/IIS/Generate_IIS.ps1

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,8 @@ if ($Artifact.Status -eq 'Present') {
131131

132132
# creating the website creates the default app & vdir underneath it
133133
$sourcePath = $mainVirtualDir.PhysicalPath
134-
$newSite = "RUN New-Website -Name '$($Site.Name)' -PhysicalPath 'C:$sourcePath' -Port $($mainBinding.BindingInformation.split(':')[-2]) -Force; ``"
134+
$targetPath = $sourcePath.Substring(2)
135+
$newSite = "RUN New-Website -Name '$($Site.Name)' -PhysicalPath 'C:$targetPath' -Port $($mainBinding.BindingInformation.split(':')[-2]) -Force; ``"
135136
$AppBuilder = New-Object System.Text.StringBuilder
136137
$null = $AppBuilder.AppendLine($newSite)
137138

@@ -149,7 +150,8 @@ if ($Artifact.Status -eq 'Present') {
149150
if ($appName.Length -gt 0) {
150151
Write-Verbose -Message ('Creating web app {0}' -f $appName)
151152
$sourcePath = $appVirtualDir.PhysicalPath
152-
$newApp = " New-WebApplication -Name '$appName' -Site '$($Site.Name)' -PhysicalPath 'C:$sourcePath' -Force; ``"
153+
$targetPath = $sourcePath.Substring(2)
154+
$newApp = " New-WebApplication -Name '$appName' -Site '$($Site.Name)' -PhysicalPath 'C:$targetPath' -Force; ``"
153155
$null = $AppBuilder.AppendLine($newApp)
154156
if ($sourcePath -ne $mainVirtualDir.PhysicalPath) {
155157
ProcessDirectory -DirectoryBuilder $DirectoryBuilder -CopyBuilder $CopyBuilder -SourcePath $sourcePath
@@ -168,12 +170,13 @@ if ($Artifact.Status -eq 'Present') {
168170

169171
Write-Verbose -Message ('Creating virtual directory {0}' -f $dirName)
170172
$sourcePath = $virtualDir.PhysicalPath
173+
$targetPath = $sourcePath.Substring(2)
171174
$newDir = ''
172175
if ($appName.Length -gt 0) {
173-
$newDir = " New-WebVirtualDirectory -Name '$dirName' -Application '$appName' -Site '$($Site.Name)' -PhysicalPath 'C:$sourcePath'; ``"
176+
$newDir = " New-WebVirtualDirectory -Name '$dirName' -Application '$appName' -Site '$($Site.Name)' -PhysicalPath 'C:$targetPath'; ``"
174177
}
175178
else {
176-
$newDir = " New-WebVirtualDirectory -Name '$dirName' -Site '$($Site.Name)' -PhysicalPath 'C:$sourcePath'; ``"
179+
$newDir = " New-WebVirtualDirectory -Name '$dirName' -Site '$($Site.Name)' -PhysicalPath 'C:$targetPath'; ``"
177180
}
178181
$null = $AppBuilder.AppendLine($newDir)
179182

0 commit comments

Comments
 (0)