Make bin/pegjs work when called via a symlink

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 #1.
This commit is contained in:
David Majda 2010-05-14 17:47:25 +02:00
parent 6f2a188efc
commit 08635b658b

View file

@ -1,4 +1,10 @@
#!/bin/sh #!/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" "$@" java -jar "$DIR/../vendor/rhino/js.jar" "$DIR/pegjs-main.js" "$DIR" "$@"