Skip to content

Commit

Permalink
Bug fix #83.
Browse files Browse the repository at this point in the history
  • Loading branch information
dotps1 committed Dec 17, 2018
1 parent a5d2e0a commit 08d2ff3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
3 changes: 2 additions & 1 deletion WinSCP/Private/Format-WinSCPPathString.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ function Format-WinSCPPathString {
)
}

if ($item.ToCharArray()[0] -ne [System.IO.Path]::AltDirectorySeparatorChar) {
$itemCharArray = $item.ToCharArray()
if ($itemCharArray[0] -ne [System.IO.Path]::AltDirectorySeparatorChar -and $itemCharArray[0] -ne '.') {
$item = [System.IO.Path]::AltDirectorySeparatorChar + $item
}

Expand Down
7 changes: 4 additions & 3 deletions WinSCP/Public/Move-WinSCPItem.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

[Parameter(
Mandatory = $true,
Position = 0,
ValueFromPipeline = $true,
ValueFromPipelineByPropertyName = $true
)]
Expand Down Expand Up @@ -56,11 +55,13 @@
$pathValue
)
if ($shouldProcess) {
if ($null -ne $destinationInfo) {
if ($null -ne $destinationInfo -and $destinationInfo.IsDirectory) {
$leaf = Split-Path -Path $pathValue -Leaf
$destinationPath = $WinSCPSession.CombinePaths(
$Destination, $leaf
$destinationInfo.FullName, $leaf
)
} else {
$destinationPath = $Destination
}

if (( Test-WinSCPPath -WinSCPSession $WinSCPSession -Path $destinationPath ) -and $Force.IsPresent) {
Expand Down
2 changes: 1 addition & 1 deletion WinSCP/Public/Test-WinSCPPath.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
)

process {
foreach($pathValue in (Format-WinSCPPathString -Path $($Path))) {
foreach($pathValue in (Format-WinSCPPathString -Path $Path)) {
try {
$output = $WinSCPSession.FileExists(
$pathValue
Expand Down

0 comments on commit 08d2ff3

Please sign in to comment.