#!/bin/bash
# Violet Vector — macOS Install Script
# Removes quarantine flags so apps can open without "damaged" warnings

echo "VIOLET://VECTOR installer"
echo "========================="
echo ""

DIR="$(cd "$(dirname "$0")" && pwd)"

for app in "$DIR"/*.app "$DIR"/**/*.app; do
    if [ -d "$app" ]; then
        echo "Fixing: $(basename "$app")"
        xattr -cr "$app"
    fi
done

for vst in "$DIR"/*.vst3 "$DIR"/**/*.vst3; do
    if [ -d "$vst" ]; then
        name="$(basename "$vst")"
        echo "Installing VST3: $name"
        xattr -cr "$vst"
        cp -R "$vst" ~/Library/Audio/Plug-Ins/VST3/
    fi
done

for au in "$DIR"/*.component "$DIR"/**/*.component; do
    if [ -d "$au" ]; then
        name="$(basename "$au")"
        echo "Installing AU: $name"
        xattr -cr "$au"
        cp -R "$au" ~/Library/Audio/Plug-Ins/Components/
    fi
done

echo ""
echo "Done. Rescan plugins in your DAW."
echo "Standalone apps are ready to open."
