From 8b5ffdcf9383b42da8d4bfcceabdfca129a97f50 Mon Sep 17 00:00:00 2001 From: detailyang Date: Sun, 10 Apr 2016 01:31:02 +0800 Subject: [PATCH] clean broken soft link when fisher install --- functions/__fisher_plugin_fetch.fish | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/functions/__fisher_plugin_fetch.fish b/functions/__fisher_plugin_fetch.fish index c5df0d9..c1f86e4 100644 --- a/functions/__fisher_plugin_fetch.fish +++ b/functions/__fisher_plugin_fetch.fish @@ -70,7 +70,15 @@ function -S __fisher_plugin_fetch printf "%s\n" "$name" debug "plugin %s" "$name" - if test ! -e $path -a ! -L $path + if test ! -e $path + if test -L $path + set -l realpath (command readlink $path) + if __fisher_file_remove "$realpath" "$fisher_file" + debug "fishfile remove broken link %s ok" "$realpath" + else + debug "fishfile remove broken link %s fail" "$realpath" + end + end if not set -q __fisher_fetch_status set -g __fisher_fetch_status printf "Installing plugin/s\n" > $stderr