fix default arg handling and error messages in win_file_version

reviewable/pr18780/r1
nitzmahone 9 years ago
parent 6456484eb3
commit c8137a47e2

@ -26,19 +26,14 @@ $result = New-Object psobject @{
changed = $false changed = $false
} }
$path = Get-AnsibleParam $params "path" -failifempty $true -resultobj $result
If ($params.path) {
$path = $params.path.ToString()
If (-Not (Test-Path -Path $path -PathType Leaf)){ If (-Not (Test-Path -Path $path -PathType Leaf)){
Fail-Json $result "Specfied path: $path not exists or not a file" Fail-Json $result "Specfied path $path does exist or is not a file."
} }
$ext = [System.IO.Path]::GetExtension($path) $ext = [System.IO.Path]::GetExtension($path)
If ( $ext -notin '.exe', '.dll'){ If ( $ext -notin '.exe', '.dll'){
Fail-Json $result "Specfied path: $path is not a vaild file type, Must be DLL or EXE." Fail-Json $result "Specfied path $path is not a vaild file type; must be DLL or EXE."
}
}
Else{
Fail-Json $result "Specfied path: $path not define."
} }
Try { Try {

Loading…
Cancel
Save