#!/usr/bin/env bash
# Let macOS open stodo after you have dragged it to Applications.
#
# stodo is not signed with an Apple developer certificate, so macOS marks the
# download as quarantined and refuses to open it: "stodo is damaged and can't
# be opened" or "cannot be opened because the developer cannot be verified".
# Neither is true. Clearing the quarantine flag is all it takes.
set -euo pipefail

APP_PATH="/Applications/stodo.app"

if [ ! -d "$APP_PATH" ]; then
    echo "Error: $APP_PATH not found."
    echo "Open the stodo .dmg, drag stodo into your Applications folder, then run this again."
    exit 1
fi

echo "Clearing the quarantine flag on $APP_PATH ..."
xattr -dr com.apple.quarantine "$APP_PATH"

echo "Done. Open stodo from Launchpad or your Applications folder."
