mportselect: always delete existing symlinks

If the previously selected port was uninstalled, the 'current' symlink
would be left pointing to the old select file that is no longer
available.

The condition using 'file exists' follows the symlink and checks its
target, not the symlink itself. It is safe to always call 'file delete'
as deletion of a non-existing target is not an error.

Closes: https://trac.macports.org/ticket/31702
This commit is contained in:
Rainer Müller
2017-02-02 14:13:43 +01:00
parent 8f8beadcc6
commit 9389e83845
+1 -3
View File
@@ -4285,9 +4285,7 @@ proc mportselect {command {group ""} {version {}}} {
# Update the selected version.
set selected_version ${conf_path}/current
if {[file exists $selected_version]} {
file delete $selected_version
}
file delete $selected_version
symlink $version $selected_version
return
}