Skip to content

Commit

Permalink
Make bin/pegjs work when called via a symlink
Browse files Browse the repository at this point in the history
Similar issue exists on Windows too (they have symlinks since Vista), but I
could not find how to dereference symlinks from batch files, so I did not fix
it. I guess this does not matter much given how little the symlinks are used in
the Windows world.

Closes pegjs#1.
  • Loading branch information
dmajda committed May 14, 2010
1 parent 6f2a188 commit 08635b6
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion bin/pegjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
#!/bin/sh

DIR=`dirname "$0"`
if [ -L "$0" ]; then
THIS_FILE=`readlink "$0"`
else
THIS_FILE=$0
fi
DIR=`dirname "$THIS_FILE"`

java -jar "$DIR/../vendor/rhino/js.jar" "$DIR/pegjs-main.js" "$DIR" "$@"

0 comments on commit 08635b6

Please sign in to comment.