Support App Bundles

Thanks to @ddaddy, ported from his fork
Fixes #267