Skip to content

Commit

Permalink
Merge pull request #248 from taliesins/fix_test_path
Browse files Browse the repository at this point in the history
fix: Fix test path usage
  • Loading branch information
taliesins authored Feb 11, 2024
2 parents 7af1e1c + 380a57a commit 7de2846
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions api/hyperv-winrm/vhd.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ $vhdType = [Microsoft.Vhd.PowerShell.VhdType]$vhd.VhdType
function Get-TarPath {
if (Get-Command "tar" -ErrorAction SilentlyContinue) {
return "tar"
} elseif (test-path "$env:SystemRoot\system32\tar.exe") {
} elseif (Test-Path "$env:SystemRoot\system32\tar.exe") {
return "$env:SystemRoot\system32\tar.exe"
} else {
return ""
Expand All @@ -63,9 +63,9 @@ function Get-TarPath {
function Get-7ZipPath {
if (Get-Command "7z" -ErrorAction SilentlyContinue) {
return "7z"
} elseif (test-path "$env:ProgramFiles\7-Zip\7z.exe") {
} elseif (Test-Path "$env:ProgramFiles\7-Zip\7z.exe") {
return "$env:ProgramFiles\7-Zip\7z.exe"
} elseif (test-path "${env:ProgramFiles(x86)}\7-Zip\7z.exe") {
} elseif (Test-Path "${env:ProgramFiles(x86)}\7-Zip\7z.exe") {
return "${env:ProgramFiles(x86)}\7-Zip\7z.exe"
} else {
return ""
Expand Down Expand Up @@ -99,7 +99,7 @@ function Expand-Downloads {
$vhdPath = Get-ChildItem $tempPath *"Virtual Hard Disks"* -Recurse -Directory
if (Test-Path $($vhdPath.FullName)) {
if ($vhdPath -and (Test-Path $vhdPath.FullName)) {
Move-Item "$($vhdPath.FullName)\*.*" $FolderPath
} else {
Move-Item "$tempPath\*.*" $FolderPath
Expand All @@ -120,7 +120,7 @@ function Expand-Downloads {
$vhdPath = Get-ChildItem $tempPath *"Virtual Hard Disks"* -Recurse -Directory
if ($vhdPath -and Test-Path $($vhdPath.FullName)) {
if ($vhdPath -and (Test-Path $vhdPath.FullName)) {
Move-Item "$($vhdPath.FullName)\*.*" $FolderPath
} else {
Move-Item "$tempPath\*.*" $FolderPath
Expand All @@ -145,7 +145,7 @@ function Expand-Downloads {
$vhdPath = Get-ChildItem $tempPath *"Virtual Hard Disks"* -Recurse -Directory
if ($vhdPath -and Test-Path $($vhdPath.FullName)) {
if ($vhdPath -and (Test-Path $vhdPath.FullName)) {
Move-Item "$($vhdPath.FullName)\*.*" $FolderPath
} else {
Move-Item "$tempPath\*.*" $FolderPath
Expand Down Expand Up @@ -210,7 +210,7 @@ function Test-Uri {
}
}
if (!(Test-Path -Path $vhd.Path)) {
if ($vhd -and !(Test-Path $vhd.Path)) {
$pathDirectory = [System.IO.Path]::GetDirectoryName($vhd.Path)
$pathFilename = [System.IO.Path]::GetFileName($vhd.Path)
Expand Down

0 comments on commit 7de2846

Please sign in to comment.