Fix dcpkdm script when run from another directory.
authorCarl Hetherington <cth@carlh.net>
Sun, 15 Nov 2020 20:46:05 +0000 (21:46 +0100)
committerCarl Hetherington <cth@carlh.net>
Sun, 15 Nov 2020 20:46:05 +0000 (21:46 +0100)
run/tools/dcpkdm

index 0a08605bf5baeb4b543f8cc1d4dc96e89fb9b652..d1012ff1871721d29058d4df3498eed7f3007a51 100755 (executable)
@@ -1,12 +1,15 @@
 #!/bin/bash
 
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+top=$DIR/../..
+
 export LD_LIBRARY_PATH=build/src:build/asdcplib/src:/home/c.hetherington/lib:$LD_LIBRARY_PATH
 if [ "$1" == "--debug" ]; then
     shift
-    gdb --args build/tools/dcpkdm "$@"
+    gdb --args $top/build/tools/dcpkdm "$@"
 elif [ "$1" == "--valgrind" ]; then
     shift
-    valgrind --tool="memcheck" --leak-check=full --show-reachable=yes build/tools/dcpkdm "$@"
+    valgrind --tool="memcheck" --leak-check=full --show-reachable=yes $top/build/tools/dcpkdm "$@"
 else
-    build/tools/dcpkdm "$@"
+    $top/build/tools/dcpkdm "$@"
 fi