#!/usr/bin/env bash

# Get the executable location, following xdg-state spec.
exe=$XDG_STATE_HOME
[ -z "$exe" ] && exe=$HOME/.local/state
exe+=/dvd

# Compile the executable
[ -x "$exe" ] || {
	src="$(dirname "$0")/../share/dvd.c"
	cc -s -std=gnu99 -Os -o "$exe" "$src"
}

# Continue executing the executable
exec -a "$(basename "$0")" "$exe" "$@"
