fix(manifest): allow for non cwd backups
- fix a fault where the backup file was only generated within the current directory - fix a fault in Pester tests, where the parameter was wrongly used as the script block for assertion.
This commit is contained in:
parent
8533997b68
commit
3c7ba0e2a4
2 changed files with 23 additions and 9 deletions
|
|
@ -68,8 +68,22 @@ function Set-Manifest
|
|||
|
||||
if ($Backup)
|
||||
{
|
||||
#FIXME: this always assumes the current working directory
|
||||
Copy-Item -Path $File -Destination "$(Split-Path -Leaf $File).bck"
|
||||
$baseDir = Split-Path $File
|
||||
|
||||
$baseName = "$(Split-Path -Leaf $File).bck"
|
||||
|
||||
#FIXME: this should be handled without an explicit condition
|
||||
if ($baseDir)
|
||||
{
|
||||
$path = Join-Path $baseDir $baseName
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
$path = $baseName
|
||||
}
|
||||
|
||||
Copy-Item -Path $File -Destination $path
|
||||
}
|
||||
|
||||
Set-Content -Path $File -Value $raw
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue