// // 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: NSNotification) { // Insert code here to initialize your application } func applicationWillTerminate(aNotification: NSNotification) { // Insert code here to tear down your application } func editFileTimer(timer: NSTimer) { 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); // } NSTimer.scheduledTimerWithTimeInterval(5.0, target: self, selector: #selector(AppDelegate.editFileTimer), userInfo: filename, repeats: false) return true; } }