Skip to content

Commit 1f98989

Browse files
committed
Created a workarround for the magento-script: If "readlink -f" fails and
if the working directory is not the project-folder the script will exit with an error. My intention was to make the "magento-script" executeable from anywhere in the system, but this does not work if I cannot (easily) detect where the project-directory is.
1 parent 45a4a4f commit 1f98989

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

magento

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,14 @@ fi
1313

1414
# Paths
1515
SCRIPTNAME=`basename $0`
16-
SCRIPTPATH=$(readlink -f "$0")
16+
SCRIPTPATH=$(readlink -f "$0" 2>/dev/null)
17+
if [ "$?" != 0 ]; then
18+
if [ ! -f "docker-compose.yml" ]; then
19+
>&2 echo " The $SCRIPTNAME-script will only work (on Mac OS) if you execute it from the project directory itself."
20+
exit 1
21+
fi
22+
SCRIPTPATH="$(pwd -P)/$SCRIPTNAME"
23+
fi
1724
PROJECTPATH=$(dirname "$SCRIPTPATH")
1825

1926
# Switch into the project directory

0 commit comments

Comments
 (0)