Skip to content

Commit

Permalink
test existence, not symlink
Browse files Browse the repository at this point in the history
it isn't safe to assume that symlinks created in the enabled/* dirs will
be symlinks later...

some users use tools like Dropbox to sync their files across systems,
and these may transform symlinks into regular files.  explicitly
checking for symlinks with tests like [ -h $file ] will break on these
systems.  these tests have been replaced with [ -e $file ] instead.
  • Loading branch information
erichs committed May 16, 2012
1 parent a825c5f commit 758c4f3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions lib/helpers.bash
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ bash-it-plugins ()
printf "%-20s%-10s%s\n" 'Plugin' 'Enabled?' 'Description'
for f in $BASH_IT/plugins/available/*.bash
do
if [ -h $BASH_IT/plugins/enabled/$(basename $f) ]; then
if [ -e $BASH_IT/plugins/enabled/$(basename $f) ]; then
enabled='x'
else
enabled=' '
Expand Down Expand Up @@ -69,7 +69,7 @@ disable-plugin ()
for f in $BASH_IT/plugins/available/*.bash
do
plugin=$(basename $f)
if [ -h $BASH_IT/plugins/enabled/$plugin ]; then
if [ -e $BASH_IT/plugins/enabled/$plugin ]; then
rm $BASH_IT/plugins/enabled/$(basename $plugin)
fi
done
Expand Down Expand Up @@ -114,7 +114,7 @@ enable-plugin ()
fi

plugin=$(basename $plugin)
if [ -h $BASH_IT/plugins/enabled/$plugin ]; then
if [ -e $BASH_IT/plugins/enabled/$plugin ]; then
printf '%s\n' "$1 is already enabled."
return
fi
Expand Down
2 changes: 1 addition & 1 deletion plugins/available/z.plugin.bash
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ about-plugin ' z is DEPRECATED, use fasd instead'
# * z -t foo # goes to most recently accessed dir matching foo
# * z -l foo # list all dirs matching foo (by frecency)

if [ -h $BASH_IT/plugins/enabled/fasd.plugin.bash ]; then
if [ -e $BASH_IT/plugins/enabled/fasd.plugin.bash ]; then
printf '%s\n' 'sorry, the z plugin is incompatible with the fasd plugin. you may use either, but not both.'
return
fi
Expand Down

0 comments on commit 758c4f3

Please sign in to comment.