This commit is contained in:
Serhiy Mytrovtsiy
2019-06-06 14:31:31 +02:00
parent e10db6aa21
commit 1045009b3f
5 changed files with 28 additions and 26 deletions

View File

@@ -7,7 +7,6 @@
//
import Cocoa
import os.log
extension Notification.Name {
static let killLauncher = Notification.Name("killLauncher")
@@ -26,28 +25,18 @@ class AppDelegate: NSObject, NSApplicationDelegate {
selector: #selector(self.terminate),
name: .killLauncher,
object: mainAppIdentifier)
let path = Bundle.main.bundlePath as NSString
var components = path.pathComponents
components.removeLast(3)
components.append("MacOS")
components.append("Stats")
let newPath = NSString.path(withComponents: components)
NSWorkspace.shared.launchApplication(newPath)
var path = Bundle.main.bundlePath as NSString
for _ in 1...4 {
path = path.deletingLastPathComponent as NSString
}
NSWorkspace.shared.launchApplication(path as String)
}
else {
self.terminate()
}
}
func applicationWillTerminate(_ aNotification: Notification) {
// Insert code here to tear down your application
}
@objc func terminate() {
os_log("WTF")
NSApp.terminate(nil)
}
}