File size: 1,352 Bytes
51eaa60
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env bash
#
# Launch script for "DB Browser for SQLite".
#
# The .app produced by build.sh is fully self-contained (Qt frameworks and the
# cocoa platform plugin are bundled and linkage is rewritten to
# @executable_path), so no DYLD_* variables are required. We still export
# QT_PLUGIN_PATH pointing at the bundled plugins as a defensive measure, and run
# the inner Mach-O binary directly so it deterministically inherits this
# environment (macOS `open` does not forward shell env vars to the launched app).
#
set -euo pipefail

SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
APP_NAME="DB Browser for SQLite"

# Locate the built .app relative to the script (no hardcoded absolute paths).
APP=""
for cand in \
    "${APP_OUTPUT_DIR:-}/$APP_NAME.app" \
    "$SCRIPT_DIR/$APP_NAME.app" \
    "$SCRIPT_DIR/build/$APP_NAME.app"; do
    if [ -n "${cand#/}" ] && [ -d "$cand" ]; then
        APP="$cand"
        break
    fi
done

if [ -z "$APP" ]; then
    echo "ERROR: '$APP_NAME.app' not found. Run build.sh first." >&2
    exit 1
fi

BIN="$APP/Contents/MacOS/$APP_NAME"
if [ ! -x "$BIN" ]; then
    echo "ERROR: executable not found inside bundle: $BIN" >&2
    exit 1
fi

# Point Qt at the bundle's own plugins (harmless with a self-contained bundle).
export QT_PLUGIN_PATH="$APP/Contents/PlugIns"

echo ">>> Launching: $APP"
exec "$BIN" "$@"