1
0
mirror of https://github.com/laravel/valet.git synced 2026-02-05 00:20:08 +01:00

correcting a few script problems

This commit is contained in:
Taylor Otwell
2016-05-10 13:26:39 -05:00
parent 97f7ae2342
commit f0556ce554
5 changed files with 67 additions and 2 deletions

12
valet
View File

@@ -1,7 +1,17 @@
#!/usr/bin/env bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
SOURCE="${BASH_SOURCE[0]}"
# Resolve possible symbolic link (http://stackoverflow.com/a/246128/416354)
while [ -h "$SOURCE" ]; do # Resolve until we are no longer a symbolic link
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # Resolve relative symbolic link
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
# Correct path if we are globally installed via Composer
if [ ! -f "$DIR/cli/valet.php" ]
then
OLDPWD="$PWD"