From ea9f62ec2fcb594df2d31f20460e3185c4b2af2b Mon Sep 17 00:00:00 2001 From: John McCall Date: Tue, 19 Apr 2022 15:30:55 -0400 Subject: [PATCH 1/2] don't strip trailing slash from root dirs --- functions/clone/New-DcnClone.ps1 | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/functions/clone/New-DcnClone.ps1 b/functions/clone/New-DcnClone.ps1 index 2bf58ac..ed64927 100644 --- a/functions/clone/New-DcnClone.ps1 +++ b/functions/clone/New-DcnClone.ps1 @@ -274,10 +274,12 @@ } } - # Remove the last "\" from the path it would mess up the mount of the VHD - if ($Destination.EndsWith("\")) { - $Destination = $Destination.Substring(0, $Destination.Length - 1) - } + # If not root dir, remove the last "\" from the path it would mess up the mount of the VHD + if (($Destination | Select-String "\\" -AllMatches).Matches.Count -gt 1) { + if ($Destination.EndsWith("\")) { + $Destination = $Destination.Substring(0, $Destination.Length - 1) + } + } # Test if the destination can be reached # Check if computer is local From 0b57d8ecbbae419e1cfef80939623f28c4d133ce Mon Sep 17 00:00:00 2001 From: John McCall Date: Tue, 19 Apr 2022 22:01:40 -0400 Subject: [PATCH 2/2] comment typo --- functions/clone/New-DcnClone.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/clone/New-DcnClone.ps1 b/functions/clone/New-DcnClone.ps1 index ed64927..006d1ee 100644 --- a/functions/clone/New-DcnClone.ps1 +++ b/functions/clone/New-DcnClone.ps1 @@ -274,7 +274,7 @@ } } - # If not root dir, remove the last "\" from the path it would mess up the mount of the VHD + # If not root dir, remove the last "\" from the path, else it would mess up the mount of the VHD if (($Destination | Select-String "\\" -AllMatches).Matches.Count -gt 1) { if ($Destination.EndsWith("\")) { $Destination = $Destination.Substring(0, $Destination.Length - 1)