Support saving serial logs

This commit is contained in:
Matthias Neeracher 2014-12-31 12:56:20 +01:00 committed by Matthias Neeracher
parent c1ea478c46
commit a27334c768

View File

@ -237,4 +237,16 @@ class ASSerialWin: NSWindowController {
serialDefaults.setValue(portDefaults, forKey:port)
userDefaults.setObject(serialDefaults, forKey:"SerialDefaults")
}
@IBAction func saveDocument(AnyObject) {
let savePanel = NSSavePanel()
savePanel.allowedFileTypes = ["log"]
savePanel.allowsOtherFileTypes = true
savePanel.extensionHidden = false
savePanel.beginSheetModalForWindow(window!, completionHandler: { (returnCode) -> Void in
if returnCode == NSFileHandlingPanelOKButton {
self.serialData.writeToURL(savePanel.URL!, atomically:false, encoding:NSUTF8StringEncoding, error:nil)
}
})
}
}