// // AppDelegate.swift // XCode Perforce // // Created by Rob Crawford on 8/26/16. // Copyright © 2016 Rob Crawford. All rights reserved. // import Cocoa @NSApplicationMain class AppDelegate: NSObject, NSApplicationDelegate { @IBOutlet weak var menulet: Menulet! func applicationDidFinishLaunching(_ aNotification: Notification) { // Insert code here to initialize your application } func applicationWillTerminate(_ aNotification: Notification) { // Insert code here to tear down your application } func editFileTimer(_ timer: Timer) { let filename:String = timer.userInfo as! String //NSLog("timer file %@", filename) menulet.p4editFile(filename) } func application(_ sender: NSApplication, openFile filename: String) -> Bool { //NSLog("file %@", filename); // menulet.p4editFile(filename) // do { // try NSFileManager.defaultManager().setAttributes([NSFilePosixPermissions:"+w"], ofItemAtPath: filename) // } catch { // print(error); // } Timer.scheduledTimer(timeInterval: 5.0, target: self, selector: #selector(AppDelegate.editFileTimer), userInfo: filename, repeats: false) return true; } }