- Notifications
You must be signed in to change notification settings - Fork 187
/
Copy pathFileUtils.ps1
25 lines (25 loc) · 975 Bytes
/
FileUtils.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
<#
Copy file contents to destination.
#>
FunctionCopy-ModuleTemplate
{
[CmdletBinding()]
Param(
[Parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[string] $Destination,
[Parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[string] $TemplatePath,
[Parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[string] $ModuleName
)
if (-not (Test-Path$Destination)) {
# Copy AutoRest config from templates if not found.
New-Item-Path ([System.IO.Directory]::GetParent($Destination)) -Type Directory -Force |Out-Null
$TemplateContent=Get-Content$TemplatePath-Raw
New-Item-Path $Destination-Type File -Value $TemplateContent.Replace("{ModuleName}",$ModuleName) |Out-Null
}
}