1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-07-09 21:29:53 +00:00

Switch to saving screenshots to the desktop.

Or, at least, try. User permission would be required. More reading necessary.
This commit is contained in:
Thomas Harte 2020-01-26 17:36:16 -05:00
parent b514756272
commit fbe479c43f

View File

@ -596,7 +596,7 @@ class MachineDocument:
return super.validateUserInterfaceItem(item)
}
/// Saves a screenshot of the
/// Saves a screenshot of the machine's current display.
@IBAction func saveScreenshot(_ sender: AnyObject!) {
// Grab a date formatter and form a file name.
let dateFormatter = DateFormatter()
@ -605,8 +605,8 @@ class MachineDocument:
let filename = ("Clock Signal Screen Shot " + dateFormatter.string(from: Date()) + ".png").replacingOccurrences(of: "/", with: "-")
.replacingOccurrences(of: ":", with: ".")
let pictursURL = FileManager.default.urls(for: .picturesDirectory, in: .userDomainMask)[0]
let url = pictursURL.appendingPathComponent(filename)
let desktopURL = FileManager.default.urls(for: .desktopDirectory, in: .userDomainMask)[0]
let url = desktopURL.appendingPathComponent(filename)
// Obtain the machine's current display.
var imageRepresentation: NSBitmapImageRep? = nil