fix crash when copy'ing latent plugins
[ardour.git] / libs / ardour / load-save-session.sh
1 #!/bin/bash
2 #
3 # Run load-save-session utility program on an existing session, as the session
4 # may be modified I would not use this utility on a session that you care
5 # about.
6 #
7 # The utility outputs some basic timing information and can be used to look at
8 # changes in the Session file resulting from the save if for instance the
9 # session is contained in a git repository.
10 #
11
12 TOP=`dirname "$0"`/../..
13 . $TOP/build/gtk2_ardour/ardev_common_waf.sh
14 ARDOUR_LIBS_DIR=$TOP/build/libs/ardour
15 PROGRAM_NAME=load-save-session
16
17 if [ ! -f './tempo.cc' ];
18         then echo "This script must be run from within the libs/ardour directory";
19         exit 1;
20 fi
21
22 OPTION=""
23 if [ "$1" == "--debug" -o "$1" == "--valgrind" -o "$1" == "--massif" ]; then
24         OPTION=$1
25         shift 1
26 fi
27
28 DIR_PATH=$1
29 if [ "$DIR_PATH" == "" ]; then
30         echo "Syntax: load-save-session.sh <session dir>"
31         exit 1
32 fi
33
34 NAME=`basename $DIR_PATH`
35
36 if [ "$OPTION" == "--debug" ]; then
37         gdb --args $ARDOUR_LIBS_DIR/$PROGRAM_NAME $DIR_PATH $NAME
38 elif [ "$OPTION" == "--valgrind" ]; then
39         MEMCHECK_OPTIONS="--leak-check=full"
40         valgrind $MEMCHECK_OPTIONS \
41         $ARDOUR_LIBS_DIR/$PROGRAM_NAME $DIR_PATH $NAME
42 elif [ "$OPTION" == "--massif" ]; then
43         MASSIF_OPTIONS="--time-unit=ms --massif-out-file=massif.out.$NAME"
44         valgrind --tool=massif $MASSIF_OPTIONS \
45         $ARDOUR_LIBS_DIR/$PROGRAM_NAME $DIR_PATH $NAME
46 else
47         $ARDOUR_LIBS_DIR/$PROGRAM_NAME $DIR_PATH $NAME
48 fi