From c7a49023d6daaba1c43ef727abcd8fd98af9a55c Mon Sep 17 00:00:00 2001 From: Jamie Snape Date: Tue, 20 Jun 2017 12:00:35 -0400 Subject: [PATCH] Let drake_visualizer work outside sandbox on Mac --- tools/drake_visualizer_apple.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tools/drake_visualizer_apple.sh b/tools/drake_visualizer_apple.sh index c5c47f9187f9..06c933d05b34 100755 --- a/tools/drake_visualizer_apple.sh +++ b/tools/drake_visualizer_apple.sh @@ -1,5 +1,19 @@ #!/bin/bash +set -e + +# If we are outside the sandbox, then change to the same relative directory as +# we would be inside the sandbox. +if ! [ -d "external/director" ]; then + guess_runfiles=$(dirname "$0")/drake_visualizer.runfiles/drake + if [ -d "$guess_runfiles/external/director" ]; then + cd "$guess_runfiles" + else + echo "$(basename $0) error: could not find director" 1>&2 + exit 1 + fi +fi + export DYLD_LIBRARY_PATH="external/director/lib${DYLD_LIBRARY_PATH:+:$DYLD_LIBRARY_PATH}" # TODO(jamiesnape): Do not hard code absolute path to vtk@8.0. export PYTHONPATH="external/director/lib/python2.7/dist-packages:/usr/local/opt/vtk@8.0/lib/python2.7/site-packages${PYTHONPATH:+:$PYTHONPATH}"