Skip to content

Commit b9db56d

Browse files
committed
Updated to support CopyMode
1 parent 9428e9e commit b9db56d

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

src/private/CopyProjectResource.ps1

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
11
function Copy-ProjectResource {
22
$data = Get-MTProjectInfo
33
$resFolder = [System.IO.Path]::Join($data.ProjectRoot, 'src', 'resources')
4-
54
if (Test-Path $resFolder) {
6-
$items = Get-ChildItem -Path $resFolder -ErrorAction SilentlyContinue
7-
if ($items) {
8-
Write-Verbose 'Files found in resource folder, copying resource folder content'
9-
foreach ($item in $items) {
10-
Copy-Item -Path $item.FullName -Destination ($data.OutputModuleDir) -Recurse -Force -ErrorAction Stop
5+
if ($data.CopyMode -eq 'Content') {
6+
# Copy the resources folder content to the OutputModuleDir
7+
$items = Get-ChildItem -Path $resFolder -ErrorAction SilentlyContinue
8+
if ($items) {
9+
Write-Verbose 'Files found in resource folder, copying resource folder content'
10+
foreach ($item in $items) {
11+
Copy-Item -Path $item.FullName -Destination ($data.OutputModuleDir) -Recurse -Force -ErrorAction Stop
12+
}
13+
}
14+
} else {
15+
# Copy the resources folder to the OutputModuleDir
16+
if (Get-ChildItem $resFolder -ErrorAction SilentlyContinue) {
17+
Write-Verbose 'Files found in resource folder, Copying resource folder'
18+
Copy-Item -Path $resFolder -Destination ($data.OutputModuleDir) -Recurse -Force -ErrorAction Stop
1119
}
1220
}
1321
}

0 commit comments

Comments
 (0)