mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-08-04 05:04:22 -07:00
fix default arg handling and error messages in win_file_version
This commit is contained in:
parent
db58300aa7
commit
092c3ccbde
1 changed files with 6 additions and 11 deletions
|
@ -26,19 +26,14 @@ $result = New-Object psobject @{
|
||||||
changed = $false
|
changed = $false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$path = Get-AnsibleParam $params "path" -failifempty $true -resultobj $result
|
||||||
|
|
||||||
If ($params.path) {
|
If (-Not (Test-Path -Path $path -PathType Leaf)){
|
||||||
$path = $params.path.ToString()
|
Fail-Json $result "Specfied path $path does exist or is not a file."
|
||||||
If (-Not (Test-Path -Path $path -PathType Leaf)){
|
|
||||||
Fail-Json $result "Specfied path: $path not exists or not a file"
|
|
||||||
}
|
|
||||||
$ext = [System.IO.Path]::GetExtension($path)
|
|
||||||
If ( $ext -notin '.exe', '.dll'){
|
|
||||||
Fail-Json $result "Specfied path: $path is not a vaild file type, Must be DLL or EXE."
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Else{
|
$ext = [System.IO.Path]::GetExtension($path)
|
||||||
Fail-Json $result "Specfied path: $path not define."
|
If ( $ext -notin '.exe', '.dll'){
|
||||||
|
Fail-Json $result "Specfied path $path is not a vaild file type; must be DLL or EXE."
|
||||||
}
|
}
|
||||||
|
|
||||||
Try {
|
Try {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue