apprt/embedded: ghostty_cli_main

This commit is contained in:
Mitchell Hashimoto
2023-09-20 12:35:52 -07:00
parent cdbf16e13b
commit 7059b4f74d
4 changed files with 55 additions and 10 deletions

View File

@@ -1,12 +1,14 @@
import AppKit
import Cocoa
import GhosttyKit
// We put the GHOSTTY_MAC_APP env var into the Info.plist to detect
// whether we launch from the app or not. A user can fake this if
// they want but they're doing so at their own detriment...
let process = ProcessInfo.processInfo
if (process.environment["GHOSTTY_MAC_APP"] == "") {
AppDelegate.logger.warning("NOT IN THE MAC APP")
ghostty_cli_main(UInt(CommandLine.argc), CommandLine.unsafeArgv)
exit(1)
}
_ = NSApplicationMain(CommandLine.argc, CommandLine.unsafeArgv)