r4370: Added Vietnamese translation (Xomhau Newnick).
[rox-filer/translations.git] / ROX-Filer / AppRun
blob5d9338b9a5c23a81db222f9e7ae25011ce4a6b8b
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 case $1 in
11 --debug) shift ;
12 if [ "$#" = 0 ] ; then
13 DEBUGGER="gdb --args" ; DEBUG_OPTIONS="-n --g-fatal-warnings"
14 else
15 DEBUGGER="gdb"
16 fi ;;
17 --valgrind) shift ; DEBUGGER="valgrind --num-callers=8";;
18 --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";;
19 --calltree) shift ; DEBUGGER="calltree";;
20 --leaks) shift ; DEBUGGER="valgrind --num-callers=8 --leak-check=yes";;
21 --compile)
22 shift
23 if [ ! -d "$APP_DIR/src" ] ; then
24 echo "ERROR from $0:" >&2
25 echo "Cannot compile - source code is missing!" >&2
26 exit 1
28 echo "Compiling $APP_DIR... please wait..." >&2
29 if [ ! -x "$APP_DIR/src/configure" ]; then
30 echo "No 'configure' script! Trying to run autoconf..."
31 (cd "$APP_DIR/src"; autoconf)
33 BUILDDIR="$APP_DIR/build"
34 [ ! -d "$BUILDDIR" ] && mkdir "$BUILDDIR"
35 rm -f "$BUILDDIR/config.cache"
36 rm -f "$APP_DIR/src/config.h" # (for upgrading)
37 cd "$BUILDDIR" && "$APP_DIR/src/configure" "$@" \
38 && make clean && make && echo Done >&2 && exit 0
39 echo Compile failed >&2
40 echo Press Return... >&2
41 read WAIT
42 exit 1
43 esac
45 if [ -z "$XDG_DATA_DIRS" -a -d /uri/0install/zero-install.sourceforge.net ]; then
46 # Try to get MIME database through Zero Install, if possible
47 0refresh zero-install.sourceforge.net/share/mime 2003-08-07
48 XDG_DATA_DIRS=/usr/local/share/:/usr/share/:/uri/0install/zero-install.sourceforge.net/share
49 export XDG_DATA_DIRS
52 BIN="$APP_DIR/$PROG"
54 if [ -x "$BIN" ]; then
55 exec $DEBUGGER "$BIN" $DEBUG_OPTIONS "$@"
56 else
57 echo "ERROR from $0:" >&2
58 echo "I cannot find an executable binary." >&2
59 echo "Trying to compile..." >&2
60 if [ -n "$DISPLAY" ]; then
61 xterm -e "$0" --compile
62 else
63 "$0" --compile
65 if [ -x "$BIN" ]; then
66 exec "$BIN" "$@"
68 exit 1