scriptcs-contrib / svm

scriptcs version manager
Apache License 2.0
43 stars 13 forks source link

Removing symlink (Windows) removes target folder too. #48

Closed paulbouwer closed 9 years ago

paulbouwer commented 9 years ago

The current method of removing a version in the PowerShell is a little too keen and removes the target folder in addition to the junction. This is due to the use of the following:

Remove-Item $versionToRemove.Location -Force -Recurse

This needs to be replaced with a check to see if the directory for the version is a junction. This can be achieved with:

[System.IO.File]::GetAttributes($path)

If the attributes include the following Directory, ReparsePoint, then it is a junction. The junction can be deleted as follows:

[System.IO.Directory]::Delete($path, $false)
adamralph commented 9 years ago

:+1: hit me today :wink: