Debian Codegraph @

lib/ansible/executor/powershell/powershell_expand_user.ps1

raw
1 # (c) 2025 Ansible Project
2 # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
3
4 [CmdletBinding()]
5 param (
6 [Parameter(Mandatory)]
7 [string]
8 $Path
9 )
10
11 $userProfile = [Environment]::GetFolderPath([Environment+SpecialFolder]::UserProfile)
12 if ($Path -eq '~') {
13 $userProfile
14 }
15 elseif ($Path.StartsWith(('~\'))) {
16 Join-Path -Path $userProfile -ChildPath $Path.Substring(2)
17 }
18 else {
19 $Path
20 }