1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-22 12:33:29 +00:00

Attempts to add an early exit for non-Metal Macs.

This will be necessary only prior to 10.14.
This commit is contained in:
Thomas Harte 2021-04-19 20:55:25 -04:00
parent 6f4ccebfa1
commit 572be48f38

View File

@ -11,12 +11,24 @@ import Cocoa
@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {
func applicationDidFinishLaunching(_ aNotification: Notification) {
private var failedMetalCheck = false
func applicationDidFinishLaunching(_ notification: Notification) {
// Insert code here to initialize your application.
}
func applicationWillTerminate(_ aNotification: Notification) {
// Insert code here to tear down your application.
// Check for at least one Metal-capable GPU; this check
// will become unnecessary if/when the minimum OS version
// that this project supports reascends to 10.14.
if (MTLCopyAllDevices().count == 0) {
self.failedMetalCheck = true
let alert = NSAlert()
alert.messageText = "This application requires a Metal-capable GPU"
alert.addButton(withTitle: "Exit")
alert.runModal()
let application = notification.object as! NSApplication
application.terminate(self)
}
}
private var hasShownOpenDocument = false