ps/Modules/Alkami.PowerShell.Common/Public/Test-PathsAreEqual.ps1

32 lines
720 B
PowerShell
Raw Normal View History

2023-05-30 22:51:22 -07:00
function Test-PathsAreEqual {
<#
.SYNOPSIS
Verify two paths are the same
.PARAMETER Path
The source path to compare against
.PARAMETER Target
The target path to compare to
#>
[CmdletBinding()]
[OutputType([bool])]
param (
[Parameter(Mandatory = $true, Position = 0)]
[ValidateNotNullOrEmpty()]
[Alias('From','Source')]
$Path,
[Parameter(Mandatory = $true, Position = 1)]
[ValidateNotNullOrEmpty()]
[Alias('To')]
$Target
)
# Do not do a test-path because they may not exist.
# We may be creating a file or something
$Target = (Join-Path $Target '')
$Path = (Join-Path $Path '')
return $Target -eq $Path
}