@@ -911,20 +911,20 @@ function current_dir($versiondir) {
911911# Returns the 'current' junction directory if in use, otherwise
912912# the version directory.
913913function link_current ($versiondir ) {
914- if (get_config NO_JUNCTIONS) { return $versiondir }
914+ if (get_config NO_JUNCTIONS) { return $versiondir }
915915
916916 $currentdir = current_dir $versiondir
917917
918- write-host " Linking $ ( friendly_path $currentdir ) => $ ( friendly_path $versiondir ) "
918+ Write-Host " Linking $ ( friendly_path $currentdir ) => $ ( friendly_path $versiondir ) "
919919
920- if ($currentdir -eq $versiondir ) {
920+ if ($currentdir -eq $versiondir ) {
921921 abort " Error: Version 'current' is not allowed!"
922922 }
923923
924- if ( test-path $currentdir ) {
924+ if ( Test-Path $currentdir ) {
925925 # remove the junction
926926 attrib - R / L $currentdir
927- & " $ env: COMSPEC " / c rmdir $currentdir
927+ Remove-Item $currentdir - Recurse - Force - ErrorAction Stop
928928 }
929929
930930 New-Item - Path $currentdir - ItemType Junction - Value $versiondir | Out-Null
@@ -938,17 +938,17 @@ function link_current($versiondir) {
938938# Returns the 'current' junction directory (if it exists),
939939# otherwise the normal version directory.
940940function unlink_current ($versiondir ) {
941- if (get_config NO_JUNCTIONS) { return $versiondir }
941+ if (get_config NO_JUNCTIONS) { return $versiondir }
942942 $currentdir = current_dir $versiondir
943943
944- if ( test-path $currentdir ) {
945- write-host " Unlinking $ ( friendly_path $currentdir ) "
944+ if ( Test-Path $currentdir ) {
945+ Write-Host " Unlinking $ ( friendly_path $currentdir ) "
946946
947947 # remove read-only attribute on link
948948 attrib $currentdir - R / L
949949
950950 # remove the junction
951- & " $ env: COMSPEC " / c " rmdir `" $currentdir `" "
951+ Remove-Item $currentdir - Recurse - Force - ErrorAction Stop
952952 return $currentdir
953953 }
954954 return $versiondir
0 commit comments