r4888: Don't try to thumbnail zero-byte files. They're either empty, or special and
[rox-filer/translations.git] / ROX-Filer / AppRun
blob2d8a932e1380cfacd054e888659aa3d4ad87b342
1 #!/bin/sh
3 PROG=ROX-Filer
5 APP_DIR=`dirname "$0"`
6 APP_DIR=`cd "$APP_DIR";pwd`; export APP_DIR
8 DEBUGGER=""
10 if [ "x$MAKE" = x ]; then
11 MAKE=make export MAKE
14 case $1 in
15 --debug) shift ;
16 if [ "$#" = 0 ] ; then
17 DEBUGGER="gdb --args" ; DEBUG_OPTIONS="-n --g-fatal-warnings"
18 else
19 DEBUGGER="gdb"
20 fi ;;
21 --valgrind) shift ; DEBUGGER="valgrind --num-callers=8";;
22 --massif) shift ; DEBUGGER="valgrind --tool=massif --alloc-fn=g_malloc --alloc-fn=g_realloc --alloc-fn=g_malloc0 --alloc-fn=g_try_malloc --alloc-fn=g_mem_chunk_alloc";;
23 --calltree) shift ; DEBUGGER="calltree";;
24 --leaks) shift ; DEBUGGER="valgrind --num-callers=8 --leak-check=yes";;
25 --compile)
26 shift
27 if [ ! -d "$APP_DIR/src" ] ; then
28 echo "ERROR from $0:" >&2
29 echo "Cannot compile - source code is missing!" >&2
30 exit 1
32 echo "Compiling $APP_DIR... please wait..." >&2
33 if [ ! -x "$APP_DIR/src/configure" ]; then
34 echo "No 'configure' script! Trying to run autoconf..."
35 (cd "$APP_DIR/src"; autoconf)
37 BUILDDIR="$APP_DIR/build"
38 [ ! -d "$BUILDDIR" ] && mkdir "$BUILDDIR"
39 rm -f "$BUILDDIR/config.cache"
40 rm -f "$APP_DIR/src/config.h" # (for upgrading)
41 cd "$BUILDDIR" && "$APP_DIR/src/configure" "$@" \
42 && $MAKE clean && $MAKE && echo Done >&2 && exit 0
43 echo Compile failed >&2
44 echo Press Return... >&2
45 read WAIT
46 exit 1
47 esac
49 if [ -z "$XDG_DATA_DIRS" -a -d /uri/0install/zero-install.sourceforge.net ]; then
50 # Try to get MIME database through Zero Install, if possible
51 0refresh zero-install.sourceforge.net/share/mime 2003-08-07
52 XDG_DATA_DIRS=/usr/local/share/:/usr/share/:/uri/0install/zero-install.sourceforge.net/share
53 export XDG_DATA_DIRS
56 BIN="$APP_DIR/$PROG"
58 if [ -x "$BIN" ]; then
59 exec $DEBUGGER "$BIN" $DEBUG_OPTIONS "$@"
60 else
61 echo "ERROR from $0:" >&2
62 echo "I cannot find an executable binary." >&2
63 echo "Trying to compile..." >&2
64 if [ -n "$DISPLAY" ]; then
65 xterm -e "$0" --compile
66 else
67 "$0" --compile
69 if [ -x "$BIN" ]; then
70 exec "$BIN" "$@"
72 exit 1