From ff53509a6c40e3c011dc54afe54ffc3e84c29af7 Mon Sep 17 00:00:00 2001 From: detailyang Date: Mon, 11 Apr 2016 10:48:18 +0800 Subject: [PATCH] Use ``test -L`` and ``-e`` to check whether file exists. Close #182. Possibly fix #182. --- functions/__fisher_plugin_fetch.fish | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/functions/__fisher_plugin_fetch.fish b/functions/__fisher_plugin_fetch.fish index 685bd48..388f06d 100644 --- a/functions/__fisher_plugin_fetch.fish +++ b/functions/__fisher_plugin_fetch.fish @@ -71,7 +71,16 @@ function -S __fisher_plugin_fetch printf "%s\n" "$name" debug "plugin %s" "$name" - if test ! -e $path + if test ! -e "$path" + if test -L "$path" + set -l realpath (command readlink "$path") + if __fisher_file_remove "$realpath" "$fisher_file" + debug "Remove broken plugin %s(%s) ok" "$name" "$realpath" + else + debug "Remove broken plugin %s(%s) fail" "$name" "$realpath" + end + end + if not set -q __fisher_fetch_status set -g __fisher_fetch_status printf "Installing plugin/s\n" > $stderr